文件
Henglianshutong/uniapp/pages/commission/index.vue

187 行
5.4 KiB
Vue

<!-- 收益中心 -->
<template>
<s-layout navbar="inner" class="index-wrap" title="收益中心" :bgStyle="bgStyle" onShareAppMessage>
<!-- 分销商信息 -->
<commission-info />
<!-- 30 日活跃警示 -->
<view v-if="userInfo?.active_30d === false || agentInfo?.active_30d === false" class="active-warn">
<view class="warn-text">近 30 日暂无本人订单,业务奖励已暂停。</view>
<button class="ss-reset-button warn-btn" @tap="sheep.$router.go('/pages/index/index')">
去首页
</button>
</view>
<!-- 账户信息 -->
<account-info />
<!-- 团队作战快捷看板 -->
<view class="team-quick-card ss-flex ss-row-between ss-col-center" @tap="sheep.$router.go('/pages/commission/team')">
<view class="team-quick-left ss-flex ss-col-center">
<view class="icon-wrap ss-flex ss-row-center ss-col-center">
<uni-icons type="staff" size="24" color="#ff6000"></uni-icons>
</view>
<view class="team-quick-info ss-m-l-16">
<view class="team-title ss-flex ss-col-center">
<text class="title-bold">团队作战中心</text>
<text class="active-badge ss-m-l-10" v-if="userInfo?.active_30d !== false && agentInfo?.active_30d !== false">正常活跃</text>
<text class="warn-badge ss-m-l-10" v-else>奖励暂停</text>
</view>
<view class="team-sub ss-m-t-6">
直推 {{ agentInfo?.child_user_count_1 || 0 }} 人 · 团队共 {{ agentInfo?.child_user_count_all || 0 }} 人
</view>
</view>
</view>
<view class="team-quick-right ss-flex ss-col-center">
<text class="manage-text">去管理</text>
<uni-icons type="right" size="14" color="#ff6000"></uni-icons>
</view>
</view>
<!-- 菜单栏 -->
<commission-menu />
<!-- 分销记录 -->
<commission-log />
<!-- 弹框 -->
<commission-condition :error="state.error" :errorData="state.errorData" />
<!-- 权限 -->
<commission-auth :error="state.error" @getAgentInfo="getAgentInfo" />
</s-layout>
</template>
<script setup>
import sheep from '@/sheep';
import { onShow } from '@dcloudio/uni-app';
import { computed, reactive } from 'vue';
import commissionInfo from './components/commission-info.vue';
import accountInfo from './components/account-info.vue';
import commissionLog from './components/commission-log.vue';
import commissionMenu from './components/commission-menu.vue';
import commissionAuth from './components/commission-auth.vue';
import commissionCondition from './components/commission-condition.vue';
const state = reactive({
error: 0,
errorData: {},
config: {
background: '/storage/default/20220704/29ac76a3c9d0d983200d612e45a052ca.png',
},
});
const agentInfo = computed(() => sheep.$store('user').agentInfo);
const userInfo = computed(() => sheep.$store('user').userInfo);
async function getUserInfo() {
await sheep.$store('user').getInfo();
}
const bgStyle = {
color: '#F7D598',
};
async function getAgentInfo() {
const res = await sheep.$store('user').getAgentInfo();
if (res?.code !== 1) {
state.error = res?.code || 0;
state.errorData = res?.data || {};
}
}
onShow(() => {
getUserInfo();
getAgentInfo();
});
</script>
<style lang="scss" scoped>
:deep(.page-main) {
background-size: 100% 100% !important;
}
.active-warn {
width: 694rpx;
margin: 0 auto 16rpx;
padding: 20rpx 24rpx;
box-sizing: border-box;
background: #fff4e5;
border-radius: 12rpx;
display: flex;
align-items: center;
justify-content: space-between;
position: relative;
z-index: 3;
.warn-text {
flex: 1;
font-size: 24rpx;
line-height: 34rpx;
color: #a17545;
padding-right: 16rpx;
}
.warn-btn {
flex-shrink: 0;
height: 52rpx;
padding: 0 22rpx;
background: #ff6000;
border-radius: 26rpx;
font-size: 22rpx;
color: #ffffff;
}
}
.team-quick-card {
width: 694rpx;
margin: 20rpx auto 0;
padding: 22rpx 28rpx;
box-sizing: border-box;
background: linear-gradient(135deg, #ffffff 0%, #fffbf0 100%);
border-radius: 16rpx;
border: 1rpx solid #ffe8c2;
box-shadow: 0 4rpx 16rpx rgba(247, 213, 152, 0.25);
position: relative;
z-index: 3;
.icon-wrap {
width: 72rpx;
height: 72rpx;
border-radius: 36rpx;
background: #fff0e6;
}
.team-quick-info {
.title-bold {
font-size: 28rpx;
font-weight: bold;
color: #692e04;
}
.active-badge {
font-size: 20rpx;
padding: 2rpx 10rpx;
border-radius: 12rpx;
background: #ecfdf5;
color: #059669;
font-weight: 500;
}
.warn-badge {
font-size: 20rpx;
padding: 2rpx 10rpx;
border-radius: 12rpx;
background: #fef2f2;
color: #dc2626;
font-weight: 500;
}
.team-sub {
font-size: 22rpx;
color: #a17545;
font-family: OPPOSANS;
}
}
.team-quick-right {
.manage-text {
font-size: 24rpx;
font-weight: 500;
color: #ff6000;
margin-right: 4rpx;
}
}
}
</style>