Files
kangyuan-mobile/pages/index/user.vue
T

577 lines
14 KiB
Vue

<template>
<view class="pages theme-ai">
<view class="bc">
<!-- <image src="/static/home/bc.png" mode="scaleToFill" /> -->
</view>
<view class="con" :style="{ paddingTop: paddingTop + 'px' }">
<view class="con_top flex-center ju-flex-start">
<view class="head_info">
<view class="head">
<image v-if="dataInfo?.avatar" :src="dataInfo?.avatar" mode="scaleToFill" />
<image v-else :src="`${$url}home/head.png`" mode="scaleToFill" />
</view>
</view>
<view class="con_info flex-between w100">
<view class="con_left">
<view class="con_name c_fff ju-flex-start">
{{ dataInfo?.nickname || '昵称' }}
<image
:src="`${$url}home/${dataInfo.type}.svg`"
class="w_38 h_32 m-l-10"
v-if="dataInfo.type !== 0"
/>
<image :src="$url + agentLevelObj[dataInfo.agentLevel]" class="w_38 h_32 m-l-10" />
</view>
<view class="con_id m-t-8">
<text>ID:{{ dataInfo.id }}</text>
</view>
</view>
<view
class="auth-btn"
:class="realStatus === 1 ? 'auth-btn-type1' : 'auth-btn-type2'"
@click="goReal()"
>
{{ realStatus === 1 ? '已认证' : '去认证' }}
</view>
</view>
</view>
<view class="b_fff" style="border-radius: 20rpx;">
<view class="card_money flex-center ju-between p-x-32" @click="go('/pages/home/wallet')">
<!-- <view
class="card_money flex-center ju-between p-x-32"
@click="go('/pages/home/pointsDetail?type=5')"
> -->
<view>
<view class="flex-center ju-flex-start m-b-8">
<view class="line34 size28 m-r-18">钱包</view>
<view class="moneyNum line36 size36">¥ {{ $fen2yuan(dataInfo.wallet || 0) }}</view>
</view>
<!-- <view class="c_fff line34">邀请好友下单得奖励</view> -->
</view>
<!-- <view class="moneyBtn" @click="go('/pages/home/pointsDetail?type=5')">立即提现</view> -->
</view>
<view class="card3 flex-center ju-evenly color_5">
<view
v-for="(v, i) in moneyArr"
:key="i"
class="center card3_item"
:class="{ 'card3_item--split': i !== 0 }"
@click="go(v.url)"
>
<view
class="card3_num m-b-8"
:style="{ color: v.color || '' }"
>{{ dataInfo[v.value] }}<text>{{ v.unit }}</text></view
>
<view class="size32">{{ v.name || 0 }}</view>
</view>
</view>
</view>
<view class="card card4 bg24">
<view class="card_title flex-center ju-between">
<view class="">我的订单</view>
<view class="card_more flex-center" @click="go('/pages/order/list')"
><span class="c0">全部</span><uni-icons type="right" size="14" color=""></uni-icons>
</view>
</view>
<view class="flex-center ju-between">
<view
class="flex-center flex-column orderItem"
v-for="(v, i) in orderList"
:key="i"
@click="go(v.url)"
>
<uni-badge
:text="i < 3 ? orderNum[v.value] : 0"
:customStyle="{ background: '#FF0000' }"
absolute="rightTop"
>
<view class="card4_icon">
<image :src="$url + v.icon" mode="scaleToFill" />
</view>
</uni-badge>
<view class="card4_name size28 color_3 m-t-16">{{ v.name }}</view>
</view>
</view>
</view>
<view class="card card5 bg24">
<view class="card_title">我的服务</view>
<view class="flex-center card5_con wrap ju-flex-start">
<view
class="flex-center flex-column card5_item"
v-for="(v, i) in menuList"
:key="i"
@click="go(v.url)"
>
<view class="card5_icon m-b-18 w_84 h_84">
<image :src="$url + v.icon" mode="scaleToFill" />
</view>
<view class="card5_name size28 color_3">{{ v.name }}</view>
</view>
</view>
</view>
</view>
</view>
<cardTabber path="/pages/index/user" placeholder />
</template>
<script setup>
import sheep from '@/sheep';
import cardTabber from '@/components/card_tabber/card_tabber.vue';
import { ref, reactive, onMounted, onUnmounted, getCurrentInstance, watch, nextTick } from 'vue';
import { onShow } from '@dcloudio/uni-app';
import { getWallet } from '@/sheep/api/home/pay';
import OrderApi from '@/sheep/api/trade/order';
let { proxy } = getCurrentInstance();
let sysInfo = uni.getSystemInfoSync();
let paddingTop = ref(20);
paddingTop.value = sysInfo.statusBarHeight + uni.upx2px(88);
let realStatus = ref(0); //是否已经实名认证
let agentLevelObj = {
2: 'home/igency_1.png',
4: 'home/igency_2.png',
3: 'home/igency_3.png',
5: 'home/igency_4.png',
};
let dataInfo = ref({
url: '',
name: '',
type: 2, //1:普通用户 2:商家
money: 1200.0,
green_num: 1000,
commission_num: 20.23,
agency_income: 999,
consumption_num: 1000,
});
let moneyArr = ref([
{
id: 1,
name: '绿色积分',
value: 'point',
url: '/pages/home/pointsDetail?type=1',
color: '#0ED72C',
},
// {
// id: 2,
// name: '佣金',
// value: 'commission_num',
// unit: '元',
// url: '/pages/home/pointsDetail?type=2',
// },
// {
// id: 3,
// name: '代理收益',
// value: 'agency_income',
// unit: '元',
// url: '/pages/home/pointsDetail?type=3',
// },
{
id: 4,
name: '消费金',
value: 'consumptionGold',
url: '/pages/home/pointsDetail?type=4',
color: '#FE5200',
},
]);
let orderList = ref([
{
name: '待支付',
icon: 'home/order0_1.png',
url: '/pages/order/list?type=1',
value: 'unpaidCount',
},
{
name: '待发货',
icon: 'home/order4_1.png',
url: '/pages/order/list?type=2',
value: 'undeliveredCount',
},
{
name: '待收货',
icon: 'home/order1_1.png',
url: '/pages/order/list?type=3',
value: 'deliveredCount',
},
{
name: '已完成',
icon: 'home/order2_1.png',
url: '/pages/order/list?type=4',
value: 'uncommentedCount',
},
{
name: '售后',
icon: 'home/order3_1.png',
url: '/pages/order/list?type=5',
value: 'afterSaleCount',
},
]);
let menuList = ref([
{
name: '邀请好友',
icon: 'home/icon1.png',
url: '/pages/home/share',
},
{
name: '收货地址',
icon: 'home/icon2.png',
url: '/pages/user/address/list',
},
{
name: '联系客服',
icon: 'home/icon3.png',
url: '',
},
{
name: '意见反馈',
icon: 'home/icon4.png',
url: '/pages/home/feedback',
},
{
name: '我的收藏',
icon: 'home/icon5.png',
url: '/pages/user/goods-collect',
},
{
name: '我的收益',
icon: 'home/icon6.png',
url: '/pages/home/agency',
},
{
name: '我的社员',
icon: 'home/icon8.png',
url: '/pages/home/staff',
},
{
name: '设置',
icon: 'home/icon7.png',
url: '/pages/public/setting',
},
]);
const goReal = () => {
uni.navigateTo({
url: '/pages/public/realname?status=' + realStatus.value,
// query: obj,
});
};
const go = (path, obj) => {
if (!path) {
// 打电话
// uni.makePhoneCall({
// phoneNumber: '4000621698',
// });
uni.showToast({
title: '功能开发中, 敬请期待',
icon: 'none',
});
return;
} else {
uni.navigateTo({
url: path,
query: obj,
});
}
};
const getData = () => {
sheep
.$store('user')
.getInfo()
.then((res) => {
dataInfo.value = res;
dataInfo.value.consumptionGold = proxy.$fen2yuan(res.consumptionGold);
realStatus.value = res.realStatus;
getWallet().then((res) => {
if (res.code === 0) {
dataInfo.value.wallet = res.data.withdrawAmount;
}
});
dataInfo.value.type = dataInfo.value?.level?.level || 0;
});
};
let levelObj = {
1: { name: '达人店长', color: '#E1C37A' },
2: { name: '明星达人店长', color: '#B49DF4' },
3: { name: '超级达人店长', color: '#43D787' },
4: { name: '店主', color: '#FB8ED5' },
};
let orderNum = ref({});
const getNumData = () => {
OrderApi.getOrderCount().then((res) => {
if (res.code === 0) {
orderNum.value = res.data;
}
});
};
onShow(async () => {
let res = await getData();
getNumData();
});
</script>
<style lang="scss" scoped>
.pages {
position: relative;
box-align: border-box;
padding-bottom: 20rpx;
background-color: #f2f4f7;
min-height: 100vh;
.bc {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 380rpx;
background: #00f;
border-radius: 0 0 30rpx 30rpx;
image {
width: 100%;
height: 100%;
}
}
.con {
position: absolute;
top: 0;
left: 0;
padding: 0rpx 40rpx;
box-sizing: border-box;
padding-bottom: 0;
width: 100%;
height: 100%;
z-index: 1;
.con_top {
margin-bottom: 36rpx;
align-items: center;
.head {
width: 130rpx;
height: 130rpx;
border-radius: 50%;
overflow: hidden;
image {
width: 100%;
height: 100%;
}
}
.con_info {
margin-left: 24rpx;
display: flex;
flex: 1;
flex-direction: row;
align-items: center;
justify-content: space-between;
// .con_left {
// display: flex;
// justify-content: center;
// align-items: flex-start;
// }
.con_left {
display: flex;
flex-direction: column;
justify-content: center;
align-items: flex-start;
min-width: 0;
}
.con_id {
// background: linear-gradient(90deg, #50504e 0%, #292b28 100%);
border-radius: 40rpx;
font-size: 26rpx;
color: #ffffff;
// line-height: 36rpx;
// text-align: center;
// padding: 7rpx 16rpx;
display: flex;
align-items: center;
display: inline-flex;
// width: 100rpx;
.img {
width: 23rpx;
height: 22rpx;
image {
width: 100%;
height: 100%;
}
}
}
.auth-btn {
width: 108rpx;
height: 40rpx;
line-height: 40rpx;
text-align: center;
border-radius: 40rpx;
font-size: 24rpx;
}
.auth-btn-type1 {
background: #fff;
color: var(--brand-blue);
}
.auth-btn-type2 {
background: linear-gradient(130deg, var(--auth-grad-start) 0%, var(--auth-grad-end) 100%);
color: #fff;
}
.con_name {
font-size: 32rpx;
font-weight: 700;
line-height: 44rpx;
margin-bottom: 4rpx;
}
.con_type {
background: linear-gradient(90deg, #50504e 0%, #292b28 100%);
border-radius: 40rpx 40rpx 40rpx 40rpx;
padding: 6rpx 12rpx;
box-sizing: border-box;
.type_name {
line-height: 36rpx;
font-size: 20rpx;
color: #e1c37a;
}
}
}
}
.card_money {
height: 100rpx;
box-sizing: border-box;
color: #ffffff;
background: linear-gradient(150deg, var(--wallet-grad-start) 0%, var(--wallet-grad-end) 100%);
font-size: 24rpx;
border-radius: 20rpx;
.moneyNum {
font-size: 30rpx;
font-weight: 900;
}
.moneyBtn {
line-height: 50rpx;
background-color: #ffe3b1;
border-radius: 25rpx;
color: #2d2d2c;
padding: 0 22rpx;
box-sizing: border-box;
}
}
}
}
.card3 {
padding-top: 34rpx;
padding-bottom: 18rpx;
box-sizing: border-box;
background-color: #fff;
border-radius: 0 0 20rpx 20rpx;
font-size: 26rpx;
border-image: linear-gradient(180deg, rgba(0, 0, 0, 0), rgba(255, 255, 255, 0.5)) 2 2;
.card3_num {
font-weight: 700;
font-size: 40rpx;
}
}
.card3_item {
position: relative;
flex: 1;
}
.card3_item--split::before {
content: '';
position: absolute;
left: 0;
top: 50%;
width: 2rpx;
height: 90rpx;
background: rgba(0, 0, 0, 0.22);
transform: translateY(-50%);
}
.card4 {
.card4_icon {
width: 68rpx;
height: 68rpx;
image {
width: 100%;
height: 100%;
}
}
}
.card5 {
.card5_icon {
image {
width: 100%;
height: 100%;
}
}
.card5_item {
width: 25%;
margin-bottom: 28rpx;
}
}
.card {
background-color: #fff;
border-radius: 20rpx;
padding: 32rpx 28rpx;
box-align: border-box;
margin-top: 32rpx;
.card_title {
font-size: 32rpx;
font-weight: 500;
margin-bottom: 34rpx;
}
.card_more {
font-size: 24rpx;
color: #666666;
}
}
.con_title {
line-height: 88rpx;
}
.orderItem {
width: 24%;
}
.head_info {
position: relative;
}
.vipImg {
width: 110rpx;
height: 36rpx;
position: absolute;
bottom: -18rpx;
left: 50%;
transform: translateX(-50%);
image {
width: 100%;
height: 100%;
}
}
</style>