1360 行
34 KiB
Vue
1360 行
34 KiB
Vue
<!-- 差价中心 -->
|
||
<template>
|
||
<view class="commission-page">
|
||
<view class="commission-wrap" :class="{ blur: !hasAuth }">
|
||
<!-- 标题栏 -->
|
||
<shopro-navbar
|
||
variant="gradient"
|
||
backIconColor="#FFFFFF"
|
||
:backTextStyle="{ color: '#FFFFFF', fontSize: '34rpx', fontWeight: '500' }"
|
||
backText="分销中心"
|
||
></shopro-navbar>
|
||
|
||
<scroll-view scroll-y class="commission-scroll">
|
||
<!-- 用户资料 + 收益 -->
|
||
<view class="user-card brand-card">
|
||
<view class="card-top u-flex u-row-between">
|
||
<view class="u-flex">
|
||
<view class="head-img-box">
|
||
<image class="head-img" :src="userInfo.avatar" mode="aspectFill"></image>
|
||
</view>
|
||
<view class="u-flex-col">
|
||
<view class="user-name">{{ userInfo.nickname || '分销商' }}</view>
|
||
<view class="user-info-box u-flex" v-if="commissionLv">
|
||
<view class="tag-box u-flex" @tap="showLv && jump('/pages/app/commission/apply')">
|
||
<image v-if="commissionLv.image" class="tag-img" :src="commissionLv.image" mode="aspectFill"></image>
|
||
<text class="tag-title">{{ commissionLv.name }}</text>
|
||
<view v-show="showLv" class="u-iconfont uicon-arrow-right tag-arrow"></view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<view class="u-flex u-col-center">
|
||
<button class="u-reset-button log-btn u-m-r-16" @tap="jump('/pages/app/commission/commission-log')">明细</button>
|
||
<button class="u-reset-button look-btn" @tap="showMoney = !showMoney">
|
||
<view class="u-iconfont" :class="showMoney ? 'uicon-eye-fill' : 'uicon-eye-off'"></view>
|
||
</button>
|
||
</view>
|
||
</view>
|
||
|
||
<view class="card-bottom u-flex" v-if="commissionWallet">
|
||
<view class="stat-item u-flex-1">
|
||
<view class="item-title">总收益</view>
|
||
<view class="item-detail">{{ showMoney ? commissionWallet.total_income || '0.00' : '***' }}</view>
|
||
</view>
|
||
<view class="stat-item u-flex-1 u-col-center">
|
||
<view class="item-title">待入账差价</view>
|
||
<view class="item-detail highlight">{{ showMoney ? commissionWallet.delay_money || '0.00' : '***' }}</view>
|
||
</view>
|
||
<view class="stat-item u-flex-1 u-col-center">
|
||
<view class="item-title">我的消费</view>
|
||
<view class="item-detail">{{ showMoney ? userInfo.total_consume || '0.00' : '***' }}</view>
|
||
</view>
|
||
</view>
|
||
<!-- 邀请码(暂时关闭,保留分销二维码/海报) -->
|
||
<!-- <view class="invite-code-box u-flex u-row-between u-col-center" v-if="dashboardData.invite_code_enable && dashboardData.invite_code">
|
||
<view class="invite-label">我的邀请码</view>
|
||
<view class="u-flex u-col-center">
|
||
<text class="invite-code">{{ showMoney ? dashboardData.invite_code : '***' }}</text>
|
||
<button class="u-reset-button copy-btn" @tap="copyInviteCode">复制</button>
|
||
</view>
|
||
</view> -->
|
||
</view>
|
||
|
||
<!-- 汇付个人进件提醒 -->
|
||
<view class="huifu-entry-card brand-card" v-if="showHuifuEntry" @tap="jump('/pages/user/wallet/onboard-bind')">
|
||
<view class="huifu-entry-desc">申请提现入口</view>
|
||
<view class="huifu-entry-btn">去填写进件资料 →</view>
|
||
</view>
|
||
|
||
<!-- 推广数据看板 -->
|
||
<view class="dashboard-card brand-card" v-if="dashboardData">
|
||
<view class="section-title">推广数据看板</view>
|
||
<view class="dashboard-grid u-flex u-flex-wrap">
|
||
<view class="dashboard-item">
|
||
<view class="dash-value">{{ showMoney ? dashboardData.team_user_count || 0 : '***' }}</view>
|
||
<view class="dash-label">团队成员</view>
|
||
</view>
|
||
<view class="dashboard-item">
|
||
<view class="dash-value">{{ showMoney ? dashboardData.direct_user_count || 0 : '***' }}</view>
|
||
<view class="dash-label">直推成员</view>
|
||
</view>
|
||
<view class="dashboard-item">
|
||
<view class="dash-value">{{ showMoney ? dashboardData.direct_order_count || 0 : '***' }}</view>
|
||
<view class="dash-label">直推订单</view>
|
||
</view>
|
||
<view class="dashboard-item">
|
||
<view class="dash-value">{{ showMoney ? dashboardData.team_order_count || 0 : '***' }}</view>
|
||
<view class="dash-label">团队订单</view>
|
||
</view>
|
||
<view class="dashboard-item">
|
||
<view class="dash-value highlight">{{ showMoney ? dashboardData.today_income || '0.00' : '***' }}</view>
|
||
<view class="dash-label">今日收益</view>
|
||
</view>
|
||
<view class="dashboard-item">
|
||
<view class="dash-value highlight">{{ showMoney ? dashboardData.month_income || '0.00' : '***' }}</view>
|
||
<view class="dash-label">本月收益</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 分销动态 -->
|
||
<view class="commission-log brand-card" v-if="commissionLog.length">
|
||
<view class="section-title">分销动态</view>
|
||
<view class="log-scroll-wrap" :style="{ height: logScrollPx + 'px' }">
|
||
<scroll-view
|
||
scroll-y
|
||
enhanced
|
||
:show-scrollbar="false"
|
||
class="log-scroll"
|
||
:style="{ height: logScrollPx + 'px' }"
|
||
@scroll="onLogScroll"
|
||
>
|
||
<view class="log-scroll-inner">
|
||
<view class="log-item-box u-flex u-row-between" v-for="item in commissionLog" :key="item.id" @tap="$u.toast(item.remark)">
|
||
<view class="log-item u-flex u-col-center u-flex-1">
|
||
<image
|
||
class="log-img"
|
||
:src="item.oper_type !== 'user' ? logMap[item.oper_type] : item.oper ? item.oper.avatar : logMap['admin']"
|
||
mode="aspectFill"
|
||
></image>
|
||
<view class="log-text u-ellipsis-1">{{ item.remark }}</view>
|
||
</view>
|
||
<text class="log-time">{{ $u.timeFrom(item.createtime) }}</text>
|
||
</view>
|
||
</view>
|
||
</scroll-view>
|
||
<view class="log-scrollbar" v-if="showLogScrollbar">
|
||
<view class="log-scrollbar-thumb" :style="logThumbStyle"></view>
|
||
</view>
|
||
</view>
|
||
<view class="loadmore-wrap" @tap="loadMore">
|
||
<text class="loadmore-text" v-if="loadStatus === 'loading'">正在加载...</text>
|
||
<text class="loadmore-text" v-else-if="loadStatus === 'loadmore'">加载更多</text>
|
||
<text class="loadmore-text is-nomore" v-else>没有更多了</text>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 功能菜单 -->
|
||
<view class="menu-box brand-card">
|
||
<view class="section-title">常用功能</view>
|
||
<view class="menu-grid u-flex u-flex-wrap">
|
||
<view
|
||
class="menu-item u-flex-col u-col-center"
|
||
v-for="(menu, index) in menuList"
|
||
v-if="!menu.isAgentFrom"
|
||
:key="index"
|
||
@tap="onMenuTap(menu)"
|
||
>
|
||
<view class="item-icon-wrap">
|
||
<image class="item-img" :src="menu.img" mode="aspectFit"></image>
|
||
</view>
|
||
<view class="item-title">{{ menu.title }}</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
<view class="scroll-bottom-safe"></view>
|
||
</scroll-view>
|
||
</view>
|
||
|
||
<!-- 分享组件 -->
|
||
<shopro-share v-model="showShare" posterType="user"></shopro-share>
|
||
|
||
<!-- 佣金中心权限验证 -->
|
||
<u-popup v-if="showAuthModal" class="auth-box" :mask="false" v-model="showAuthModal" mode="center" :mask-close-able="false" close-icon-pos="top-left" border-radius="20">
|
||
<view class="notice-box">
|
||
<view class="img-wrap"><image class="notice-img" :src="authNotice.img" mode=""></image></view>
|
||
<view class="notice-title">{{ authNotice.title }}</view>
|
||
<view class="notice-detail">{{ authNotice.detail }}</view>
|
||
<button class="u-reset-button notice-btn" @tap="onAuthBtn(authNotice.btnPath)">{{ authNotice.btnText }}</button>
|
||
<button
|
||
class="u-reset-button regional-agent-btn"
|
||
v-if="showRegionalAgentEntry"
|
||
@tap="jump('/pages/app/regional-agent/index')"
|
||
>
|
||
{{ regionalAgentEntryText }}
|
||
</button>
|
||
<button class="u-reset-button back-btn" @tap="$Router.back()" v-if="!authNotice.hideBtn">返回</button>
|
||
<button class="u-reset-button back-btn" @tap="hasAuth = true" v-else>取消</button>
|
||
</view>
|
||
</u-popup>
|
||
|
||
<!-- 成为分销商条件 -->
|
||
<u-popup
|
||
v-if="showTerm"
|
||
class="into-agent-modal"
|
||
:bgStyle="{
|
||
background: 'none'
|
||
}"
|
||
v-model="showTerm"
|
||
mode="center"
|
||
:mask="false"
|
||
:mask-close-able="false"
|
||
>
|
||
<view class="condition-box u-flex u-row-center u-col-center">
|
||
<!-- 商品 -->
|
||
<view class="goods-condition u-flex-col u-col-center" v-if="showGoodsTerm">
|
||
<scroll-view class="card-wrap" scroll-y="true">
|
||
<view class="card-box u-flex u-m-x-10 u-m-y-10" v-for="item in goodsTermList" :key="item.id" @tap="jump('/pages/goods/detail', { id: item.id })">
|
||
<view class="img-wrap"><image class="goods-img" :src="item.image" mode=""></image></view>
|
||
<view class="detail u-fle u-row-between">
|
||
<view class="title u-ellipsis-2 u-m-b-10">{{ item.title }}</view>
|
||
<view class="sub u-ellipsis-1">{{ item.subtitle }}</view>
|
||
</view>
|
||
</view>
|
||
|
||
<view class="hack" style="height: 100rpx;"></view>
|
||
</scroll-view>
|
||
<view class="btn-box u-flex-col u-col-center u-p-20">
|
||
<button class="u-reset-button buy-btn u-m-b-20" @tap="$Router.back()">知道了</button>
|
||
<button class="u-reset-button regional-link-btn u-m-b-10" v-if="showRegionalAgentEntry" @tap="jump('/pages/app/regional-agent/index')">{{ regionalAgentEntryText }}</button>
|
||
<view class="tips">* 购买指定商品即可成为分销商</view>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 金额人数 -->
|
||
<view class="goods-condition u-flex u-row-between" v-if="showMoneyTerm">
|
||
<scroll-view class="card-wrap" scroll-y="true">
|
||
<view class="card-box u-flex u-m-x-10 u-m-y-10" :class="{ 'filter-card': userInfo.total_consume == moneyTermNum }">
|
||
<view class="img-wrap"><image class="goods-img" :src="$IMG_URL + '/imgs/user/commission_task_card.png'" mode=""></image></view>
|
||
<view class="detail">
|
||
<view class="title u-ellipsis-2 u-m-l-10">满足以下消费金额</view>
|
||
|
||
<!-- 进度条 -->
|
||
<view class="u-flex modal-progress ">
|
||
<view class="progress-box u-m-l-30 u-flex u-col-bottom">
|
||
<view class="cu-progress" style="width:150rpx ;">
|
||
<!-- 圆环 -->
|
||
<view
|
||
class="round-wrap"
|
||
v-if="userInfo.total_consume != moneyTermNum"
|
||
:style="[{ left: getProgress(userInfo.total_consume, moneyTermNum) + '%' }]"
|
||
>
|
||
<view class="round-inner"></view>
|
||
</view>
|
||
<u-line-progress
|
||
height="12"
|
||
:show-percent="false"
|
||
inactive-color="#999999"
|
||
:percent="getProgress(userInfo.total_consume, moneyTermNum)"
|
||
active-color="#1677FF"
|
||
></u-line-progress>
|
||
<!-- 已完成数 -->
|
||
<view
|
||
class="progress-num u-m-t-10"
|
||
v-if="userInfo.total_consume != moneyTermNum"
|
||
:style="[{ left: getProgress(userInfo.total_consume, moneyTermNum) + '%' }]"
|
||
>
|
||
{{ userInfo.total_consume }}
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<view class="progress-tip" v-if="userInfo.total_consume != moneyTermNum">{{ moneyTermNum }}</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</scroll-view>
|
||
<view class="btn-box u-flex-col u-p-20 u-col-center">
|
||
<button class="u-reset-button buy-btn u-m-b-10" @tap="$Router.back()">知道了</button>
|
||
<button class="u-reset-button regional-link-btn u-m-b-10" v-if="showRegionalAgentEntry" @tap="jump('/pages/app/regional-agent/index')">{{ regionalAgentEntryText }}</button>
|
||
<view class="tips">* 满足指定消费金额即可成为分销商</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</u-popup>
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
import { mapMutations, mapActions, mapState, mapGetters } from 'vuex';
|
||
import share from '@/shopro/share';
|
||
export default {
|
||
components: {},
|
||
data() {
|
||
return {
|
||
showShare: false, //是否显示分享海报
|
||
showMoney: true, //是否显示金额
|
||
hasAuth: true, //是否有权限
|
||
commissionLv: null, //分销商等级
|
||
commissionWallet: null, //分销商钱包
|
||
agentFrom: null, //是否显示我的资料
|
||
showLv: true,
|
||
commissionLog: [], //动态
|
||
logScrollPx: 0,
|
||
showLogScrollbar: false,
|
||
logThumbTopPx: 0,
|
||
logThumbHeightPx: 40,
|
||
logScrollTop: 0,
|
||
logViewHeight: 0,
|
||
logContentHeight: 0,
|
||
loadStatus: 'loadmore', //loadmore-加载前的状态,loading-加载中的状态,nomore-没有更多的状态
|
||
currentPage: 1,
|
||
lastPage: 1,
|
||
logMap: {
|
||
system: this.$IMG_URL + '/imgs/commission/commission_base_notice.png',
|
||
admin: this.$IMG_URL + '/imgs/commission/commission_base_avatar.png'
|
||
},
|
||
showTerm: false, //条件弹窗
|
||
showGoodsTerm: false, //商品条件
|
||
showMoneyTerm: false, //金额条件
|
||
goodsTermList: [],
|
||
moneyTermNum: 0,
|
||
authNotice: {},
|
||
regionalAgentStatus: null, // null=未加载, none=非代理, pending=审核中, normal=已是代理
|
||
dashboardData: null,
|
||
huifuOnboard: null,
|
||
menuList: [
|
||
//menu
|
||
{
|
||
img: this.$IMG_URL + '/imgs/commission/commission_icon1.png',
|
||
title: '我的团队',
|
||
path: '/pages/app/commission/team'
|
||
},
|
||
{
|
||
img: this.$IMG_URL + '/imgs/commission/commission_icon2.png',
|
||
title: '差价明细',
|
||
path: '/pages/app/commission/commission-log'
|
||
},
|
||
{
|
||
img: this.$IMG_URL + '/imgs/commission/commission_icon3.png',
|
||
title: '分销订单',
|
||
path: '/pages/app/commission/order'
|
||
},
|
||
{
|
||
img: this.$IMG_URL + '/imgs/commission/commission_icon4.png',
|
||
title: '推广商品',
|
||
path: '/pages/app/commission/goods'
|
||
},
|
||
{
|
||
img: this.$IMG_URL + '/imgs/commission/commission_icon5.png',
|
||
title: '我的资料',
|
||
path: '/pages/app/commission/apply',
|
||
isAgentFrom: true
|
||
},
|
||
{
|
||
img: this.$IMG_URL + '/imgs/commission/commission_icon6.png',
|
||
title: '分销排行',
|
||
path: '/pages/app/commission/rankings'
|
||
},
|
||
{
|
||
img: this.$IMG_URL + '/imgs/commission/commission_icon7.png',
|
||
title: '邀请海报',
|
||
action: 'invitePoster'
|
||
},
|
||
{
|
||
img: this.$IMG_URL + '/imgs/commission/commission_icon8.png',
|
||
title: '分享记录',
|
||
path: '/pages/app/commission/share-log'
|
||
},
|
||
{
|
||
img: this.$IMG_URL + '/imgs/commission/commission_icon1.png',
|
||
title: '区域公司',
|
||
path: '/pages/app/regional-agent/index'
|
||
}
|
||
// 绑定邀请码(暂时关闭)
|
||
// {
|
||
// img: this.$IMG_URL + '/imgs/commission/commission_icon2.png',
|
||
// title: '绑定邀请码',
|
||
// path: '/pages/app/commission/bind-invite'
|
||
// }
|
||
]
|
||
};
|
||
},
|
||
computed: {
|
||
...mapGetters(['userInfo', 'agentInfo']),
|
||
showAuthModal: {
|
||
get() {
|
||
return !!this.authNotice.title && !this.hasAuth;
|
||
},
|
||
set(val) {
|
||
return val;
|
||
}
|
||
},
|
||
showRegionalAgentEntry() {
|
||
if (this.hasAuth || this.regionalAgentStatus === null) {
|
||
return false;
|
||
}
|
||
return true;
|
||
},
|
||
regionalAgentEntryText() {
|
||
if (this.regionalAgentStatus === 'normal') {
|
||
return '进入区域公司中心';
|
||
}
|
||
if (this.regionalAgentStatus === 'pending') {
|
||
return '查看区域公司申请';
|
||
}
|
||
return '申请区域公司';
|
||
},
|
||
logThumbStyle() {
|
||
return {
|
||
height: `${this.logThumbHeightPx}px`,
|
||
transform: `translateY(${this.logThumbTopPx}px)`
|
||
};
|
||
},
|
||
showHuifuEntry() {
|
||
const h = this.huifuOnboard;
|
||
if (!h || !h.required) return false;
|
||
if (h.status === 'approved') return false;
|
||
return !!h.can_submit || !h.status;
|
||
},
|
||
},
|
||
onShow() {
|
||
if (this.$store.getters.isLogin) {
|
||
try {
|
||
share.setShareInfo({ params: { from: '1' } });
|
||
} catch (e) {}
|
||
}
|
||
this.init();
|
||
},
|
||
onHide() {
|
||
this.commissionLog = [];
|
||
this.lastPage = 1;
|
||
this.currentPage = 1;
|
||
this.showLogScrollbar = false;
|
||
this.logThumbTopPx = 0;
|
||
this.logScrollTop = 0;
|
||
},
|
||
onLoad() {
|
||
this.logScrollPx = uni.upx2px(320);
|
||
},
|
||
onPullDownRefresh() {
|
||
this.currentPage = 1;
|
||
this.lastPage = 1;
|
||
this.commissionLog = [];
|
||
this.init();
|
||
},
|
||
methods: {
|
||
...mapActions(['getAgent', 'getUserInfo']),
|
||
init() {
|
||
return Promise.all([this.getStatus(), this.getUserInfo(), this.loadRegionalAgentStatus()]).then(() => {
|
||
uni.stopPullDownRefresh();
|
||
});
|
||
},
|
||
|
||
loadRegionalAgentStatus() {
|
||
return this.$http('regionalAgent.info')
|
||
.then(res => {
|
||
if (res.code !== 1) {
|
||
this.regionalAgentStatus = 'none';
|
||
return;
|
||
}
|
||
if (res.data && res.data.status === 'close') {
|
||
this.regionalAgentStatus = 'none';
|
||
return;
|
||
}
|
||
const agents = (res.data && res.data.agents) || [];
|
||
if (!Array.isArray(agents) || !agents.length) {
|
||
this.regionalAgentStatus = 'none';
|
||
return;
|
||
}
|
||
if (agents.some(item => item.status === 'normal')) {
|
||
this.regionalAgentStatus = 'normal';
|
||
} else if (agents.some(item => item.status === 'pending')) {
|
||
this.regionalAgentStatus = 'pending';
|
||
} else {
|
||
this.regionalAgentStatus = 'none';
|
||
}
|
||
})
|
||
.catch(() => {
|
||
this.regionalAgentStatus = 'none';
|
||
});
|
||
},
|
||
|
||
// 功能菜单
|
||
onMenuTap(menu) {
|
||
if (menu.action === 'invitePoster') {
|
||
if (!this.$store.getters.isLogin) {
|
||
this.$store.dispatch('showAuthModal', 'accountLogin');
|
||
return;
|
||
}
|
||
try {
|
||
share.setShareInfo();
|
||
} catch (e) {
|
||
this.$u.toast('请先在商城后台配置分享信息');
|
||
return;
|
||
}
|
||
this.showShare = true;
|
||
return;
|
||
}
|
||
this.jump(menu.path);
|
||
},
|
||
|
||
// 跳转
|
||
jump(path, query) {
|
||
if (!path) {
|
||
this.showShare = true;
|
||
} else {
|
||
this.$Router.push({
|
||
path: path,
|
||
query: query
|
||
});
|
||
}
|
||
},
|
||
|
||
// 百分比
|
||
getProgress(sales, stock) {
|
||
let unit = '';
|
||
if (stock + sales > 0) {
|
||
let num = (sales / stock) * 100;
|
||
unit = num.toFixed(2);
|
||
} else {
|
||
unit = '0';
|
||
}
|
||
return Number(unit);
|
||
},
|
||
|
||
// 身份认证
|
||
getStatus() {
|
||
let that = this;
|
||
this.getAgent().then(res => {
|
||
uni.stopPullDownRefresh();
|
||
if (res.code === 1) {
|
||
that.authStatus(res.data);
|
||
that.commissionWallet = res.data.data;
|
||
that.commissionLv = res.data.data?.agent_level;
|
||
that.huifuOnboard = res.data.huifu_onboard || null;
|
||
that.showLv = res.data.upgrade_display;
|
||
that.menuList.map(item => {
|
||
if (item.title === '我的资料') {
|
||
item.isAgentFrom = !res.data.agent_form;
|
||
}
|
||
});
|
||
that.commissionWallet && that.getLog();
|
||
that.getDashboard();
|
||
}
|
||
});
|
||
},
|
||
|
||
getDashboard() {
|
||
this.$http('commission.dashboard').then(res => {
|
||
if (res.code === 1) {
|
||
this.dashboardData = res.data;
|
||
}
|
||
});
|
||
},
|
||
|
||
// copyInviteCode() {
|
||
// if (!this.dashboardData || !this.dashboardData.invite_code) return;
|
||
// uni.setClipboardData({
|
||
// data: this.dashboardData.invite_code,
|
||
// success: () => {
|
||
// this.$u.toast('邀请码已复制');
|
||
// }
|
||
// });
|
||
// },
|
||
|
||
// 分销动态
|
||
getLog() {
|
||
let that = this;
|
||
that.loadStatus = 'loading';
|
||
this.$http('commission.log', {
|
||
page: that.currentPage,
|
||
per_page: 5
|
||
}, '', false).then(res => {
|
||
if (res.code === 1) {
|
||
const pageData = res.data || {};
|
||
const list = pageData.data || [];
|
||
const lastPage = Number(pageData.last_page) || 1;
|
||
const currentPage = Number(pageData.current_page) || that.currentPage;
|
||
that.commissionLog = [...that.commissionLog, ...list];
|
||
that.lastPage = lastPage;
|
||
that.currentPage = currentPage;
|
||
that.loadStatus = currentPage < lastPage ? 'loadmore' : 'nomore';
|
||
that.updateLogScrollbar();
|
||
} else {
|
||
that.loadStatus = Number(that.currentPage) < Number(that.lastPage) ? 'loadmore' : 'nomore';
|
||
}
|
||
}).catch(() => {
|
||
that.loadStatus = Number(that.currentPage) < Number(that.lastPage) ? 'loadmore' : 'nomore';
|
||
});
|
||
},
|
||
|
||
updateLogScrollbar() {
|
||
this.$nextTick(() => {
|
||
setTimeout(() => {
|
||
const query = uni.createSelectorQuery().in(this);
|
||
query.select('.log-scroll-inner').boundingClientRect();
|
||
query.exec(res => {
|
||
const contentH = res && res[0] ? res[0].height : 0;
|
||
this.logContentHeight = contentH;
|
||
this.syncLogThumb(this.logScrollTop, contentH);
|
||
});
|
||
}, 150);
|
||
});
|
||
},
|
||
|
||
syncLogThumb(scrollTop, scrollHeight) {
|
||
const viewH = this.logScrollPx || uni.upx2px(320);
|
||
const trackH = viewH;
|
||
this.logViewHeight = viewH;
|
||
if (!scrollHeight || scrollHeight <= viewH + 2) {
|
||
this.showLogScrollbar = false;
|
||
this.logThumbTopPx = 0;
|
||
return;
|
||
}
|
||
this.showLogScrollbar = true;
|
||
const thumbH = Math.max(Math.round((viewH / scrollHeight) * trackH), 24);
|
||
this.logThumbHeightPx = thumbH;
|
||
const maxScroll = scrollHeight - viewH;
|
||
const maxThumbTop = trackH - thumbH;
|
||
this.logThumbTopPx = maxScroll > 0 ? Math.round((scrollTop / maxScroll) * maxThumbTop) : 0;
|
||
},
|
||
|
||
onLogScroll(e) {
|
||
const detail = e.detail || {};
|
||
const scrollTop = detail.scrollTop || 0;
|
||
const scrollHeight = detail.scrollHeight || this.logContentHeight;
|
||
this.logScrollTop = scrollTop;
|
||
this.syncLogThumb(scrollTop, scrollHeight);
|
||
},
|
||
|
||
// 加载更多
|
||
loadMore() {
|
||
if (this.loadStatus === 'loading' || this.loadStatus === 'nomore') return;
|
||
const lastPage = Number(this.lastPage) || 1;
|
||
const currentPage = Number(this.currentPage) || 1;
|
||
if (currentPage >= lastPage) {
|
||
this.loadStatus = 'nomore';
|
||
return;
|
||
}
|
||
this.currentPage = currentPage + 1;
|
||
this.getLog();
|
||
},
|
||
|
||
// 状态鉴权
|
||
authStatus(data) {
|
||
switch (data.status) {
|
||
case 'forbidden':
|
||
this.hasAuth = false;
|
||
this.showTerm = false;
|
||
this.authNotice = {
|
||
img: this.$IMG_URL + '/imgs/commission/auth_stop.png',
|
||
title: '抱歉!你的账户已被禁用',
|
||
detail: data.msg,
|
||
btnText: '联系客服',
|
||
btnPath: '/pages/public/chat/index'
|
||
};
|
||
break;
|
||
case 'pending':
|
||
this.hasAuth = false;
|
||
this.showTerm = false;
|
||
this.authNotice = {
|
||
img: this.$IMG_URL + '/imgs/commission/auth_stop.png',
|
||
title: '正在审核中!',
|
||
detail: data.msg,
|
||
btnText: '知道了',
|
||
btnPath: ''
|
||
};
|
||
break;
|
||
case 'needinfo':
|
||
this.hasAuth = false;
|
||
this.authNotice = {
|
||
img: this.$IMG_URL + '/imgs/commission/auth_perfect.png',
|
||
title: '待完善信息',
|
||
detail: data.msg,
|
||
btnText: '去完善',
|
||
btnPath: '/pages/app/commission/apply'
|
||
};
|
||
break;
|
||
case 'reject':
|
||
this.hasAuth = false;
|
||
this.showTerm = false;
|
||
this.authNotice = {
|
||
img: this.$IMG_URL + '/imgs/commission/auth_reject.png',
|
||
title: '申请驳回',
|
||
detail: data.msg,
|
||
btnText: '修改资料',
|
||
btnPath: '/pages/app/commission/apply'
|
||
};
|
||
break;
|
||
case 'close':
|
||
this.hasAuth = false;
|
||
this.showTerm = false;
|
||
this.authNotice = {
|
||
img: this.$IMG_URL + '/imgs/commission/auth_close.png',
|
||
title: '分销中心已关闭',
|
||
detail: data.msg,
|
||
btnText: '我知道了',
|
||
btnPath: ''
|
||
};
|
||
break;
|
||
case 'freeze':
|
||
this.hasAuth = false;
|
||
this.showTerm = false;
|
||
this.authNotice = {
|
||
img: this.$IMG_URL + '/imgs/commission/auth_freeze.png',
|
||
title: '抱歉!你的账户已被冻结',
|
||
detail: data.msg,
|
||
btnText: '联系客服',
|
||
btnPath: '/pages/public/chat/index',
|
||
hideBtn: true
|
||
};
|
||
break;
|
||
case null:
|
||
this.hasAuth = false;
|
||
this.showTerm = true;
|
||
if (data.become_agent) {
|
||
if (data.become_agent.type === 'goods') {
|
||
this.showGoodsTerm = true;
|
||
this.getGoodsTermList(data.become_agent.value);
|
||
}
|
||
if (data.become_agent.type === 'consume') {
|
||
this.showMoneyTerm = true;
|
||
this.moneyTermNum = data.become_agent.value;
|
||
}
|
||
}
|
||
break;
|
||
default:
|
||
this.hasAuth = true;
|
||
this.showTerm = false;
|
||
}
|
||
},
|
||
|
||
// 成为分销商,商品列表
|
||
getGoodsTermList(ids) {
|
||
let that = this;
|
||
that.$http('goods.lists', {
|
||
goods_ids: ids
|
||
}).then(res => {
|
||
if (res.code === 1) {
|
||
that.goodsTermList = res.data.data;
|
||
}
|
||
});
|
||
},
|
||
|
||
// 权限
|
||
onAuthBtn(path) {
|
||
path
|
||
? this.$Router.push({
|
||
path: path
|
||
})
|
||
: this.$Router.back();
|
||
}
|
||
}
|
||
};
|
||
</script>
|
||
|
||
<style lang="scss" scoped>
|
||
.commission-page {
|
||
width: 100%;
|
||
height: 100%;
|
||
}
|
||
|
||
.commission-wrap {
|
||
background: $brand-header-gradient;
|
||
height: 100vh;
|
||
width: 100%;
|
||
transition: all 0.3s ease-in-out;
|
||
display: flex;
|
||
flex-direction: column;
|
||
overflow: hidden;
|
||
}
|
||
|
||
.commission-scroll {
|
||
flex: 1;
|
||
height: 0;
|
||
padding: 0 $brand-page-gutter;
|
||
box-sizing: border-box;
|
||
}
|
||
|
||
.scroll-bottom-safe {
|
||
height: calc(32rpx + env(safe-area-inset-bottom));
|
||
}
|
||
|
||
.section-title {
|
||
font-size: 30rpx;
|
||
font-weight: 600;
|
||
color: $brand-text;
|
||
margin-bottom: 24rpx;
|
||
}
|
||
|
||
.huifu-entry-card {
|
||
margin-bottom: $brand-section-gap;
|
||
padding: 28rpx;
|
||
background: linear-gradient(135deg, #e8f3ff 0%, #f5f9ff 100%);
|
||
border: 1rpx solid rgba(22, 119, 255, 0.25);
|
||
border-radius: 16rpx;
|
||
|
||
.huifu-entry-desc {
|
||
font-size: 28rpx;
|
||
font-weight: 500;
|
||
color: #1677ff;
|
||
line-height: 1.5;
|
||
margin-bottom: 16rpx;
|
||
}
|
||
|
||
.huifu-entry-btn {
|
||
font-size: 26rpx;
|
||
font-weight: 500;
|
||
color: #1677ff;
|
||
}
|
||
}
|
||
|
||
// 用户资料卡片
|
||
.user-card {
|
||
margin-top: 16rpx;
|
||
margin-bottom: $brand-section-gap;
|
||
padding: 32rpx 28rpx;
|
||
|
||
.card-top {
|
||
padding-bottom: 28rpx;
|
||
margin-bottom: 28rpx;
|
||
border-bottom: 1rpx solid $brand-border;
|
||
|
||
.user-name {
|
||
font-size: 32rpx;
|
||
font-weight: 600;
|
||
color: $brand-text;
|
||
line-height: 44rpx;
|
||
margin-bottom: 12rpx;
|
||
max-width: 320rpx;
|
||
}
|
||
|
||
.log-btn {
|
||
min-width: 88rpx;
|
||
min-height: 56rpx;
|
||
padding: 0 20rpx;
|
||
line-height: 56rpx;
|
||
border: 1rpx solid $brand-gold;
|
||
border-radius: 28rpx;
|
||
font-size: 24rpx;
|
||
font-weight: 500;
|
||
color: $brand-gold;
|
||
background: rgba($brand-gold, 0.08);
|
||
}
|
||
|
||
.look-btn {
|
||
min-width: 88rpx;
|
||
min-height: 88rpx;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
|
||
.u-iconfont {
|
||
color: $brand-text-muted;
|
||
font-size: 44rpx;
|
||
}
|
||
}
|
||
}
|
||
|
||
.head-img-box {
|
||
margin-right: 24rpx;
|
||
width: 96rpx;
|
||
height: 96rpx;
|
||
border-radius: 50%;
|
||
border: 2rpx solid $brand-gold-light;
|
||
overflow: hidden;
|
||
flex-shrink: 0;
|
||
|
||
.head-img {
|
||
width: 100%;
|
||
height: 100%;
|
||
}
|
||
}
|
||
|
||
.tag-box {
|
||
background: rgba($brand-gold, 0.12);
|
||
border: 1rpx solid rgba($brand-gold, 0.35);
|
||
border-radius: 24rpx;
|
||
padding: 4rpx 12rpx 4rpx 4rpx;
|
||
max-width: 280rpx;
|
||
|
||
.tag-img {
|
||
width: 36rpx;
|
||
height: 36rpx;
|
||
border-radius: 50%;
|
||
flex-shrink: 0;
|
||
}
|
||
|
||
.tag-title {
|
||
font-size: 22rpx;
|
||
padding: 0 8rpx;
|
||
font-weight: 500;
|
||
color: $brand-gold;
|
||
line-height: 36rpx;
|
||
}
|
||
|
||
.tag-arrow {
|
||
color: $brand-gold;
|
||
font-size: 24rpx;
|
||
}
|
||
}
|
||
|
||
.card-bottom {
|
||
.stat-item {
|
||
text-align: center;
|
||
}
|
||
|
||
.item-title {
|
||
font-size: 24rpx;
|
||
font-weight: 400;
|
||
color: $brand-text-muted;
|
||
line-height: 34rpx;
|
||
}
|
||
|
||
.item-detail {
|
||
font-size: 36rpx;
|
||
font-weight: 600;
|
||
color: $brand-text;
|
||
line-height: 50rpx;
|
||
margin-top: 12rpx;
|
||
|
||
&.highlight {
|
||
color: $brand-gold;
|
||
}
|
||
}
|
||
}
|
||
|
||
.invite-code-box {
|
||
margin-top: 20rpx;
|
||
padding-top: 20rpx;
|
||
border-top: 1rpx solid $brand-border;
|
||
|
||
.invite-label {
|
||
font-size: 24rpx;
|
||
color: $brand-text-muted;
|
||
}
|
||
|
||
.invite-code {
|
||
font-size: 28rpx;
|
||
font-weight: 600;
|
||
color: $brand-gold;
|
||
margin-right: 16rpx;
|
||
}
|
||
|
||
.copy-btn {
|
||
font-size: 22rpx;
|
||
color: $brand-gold;
|
||
padding: 4rpx 16rpx;
|
||
border: 1rpx solid $brand-gold;
|
||
border-radius: 20rpx;
|
||
}
|
||
}
|
||
}
|
||
|
||
.dashboard-card {
|
||
margin-bottom: $brand-section-gap;
|
||
padding: 28rpx;
|
||
|
||
.dashboard-grid {
|
||
margin-top: 16rpx;
|
||
}
|
||
|
||
.dashboard-item {
|
||
width: 33.33%;
|
||
text-align: center;
|
||
padding: 16rpx 0;
|
||
|
||
.dash-value {
|
||
font-size: 32rpx;
|
||
font-weight: 600;
|
||
color: $brand-text;
|
||
line-height: 44rpx;
|
||
|
||
&.highlight {
|
||
color: $brand-gold;
|
||
}
|
||
}
|
||
|
||
.dash-label {
|
||
font-size: 22rpx;
|
||
color: $brand-text-muted;
|
||
margin-top: 8rpx;
|
||
}
|
||
}
|
||
}
|
||
|
||
// 分销动态
|
||
.commission-log {
|
||
margin-bottom: $brand-section-gap;
|
||
padding: 28rpx;
|
||
|
||
.log-scroll-wrap {
|
||
position: relative;
|
||
overflow: hidden;
|
||
}
|
||
|
||
.log-scroll {
|
||
width: 100%;
|
||
box-sizing: border-box;
|
||
}
|
||
|
||
.log-scroll-inner {
|
||
padding-right: 20rpx;
|
||
box-sizing: border-box;
|
||
}
|
||
|
||
.log-scrollbar {
|
||
position: absolute;
|
||
right: 0;
|
||
top: 0;
|
||
bottom: 0;
|
||
width: 10rpx;
|
||
border-radius: 10rpx;
|
||
background: rgba(0, 0, 0, 0.08);
|
||
pointer-events: none;
|
||
z-index: 2;
|
||
}
|
||
|
||
.log-scrollbar-thumb {
|
||
position: absolute;
|
||
left: 0;
|
||
top: 0;
|
||
width: 100%;
|
||
border-radius: 10rpx;
|
||
background: rgba(0, 0, 0, 0.35);
|
||
will-change: transform;
|
||
}
|
||
|
||
.loadmore-wrap {
|
||
padding-top: 20rpx;
|
||
text-align: center;
|
||
}
|
||
|
||
.loadmore-text {
|
||
font-size: 26rpx;
|
||
color: #999999;
|
||
padding: 12rpx 0;
|
||
|
||
&.is-nomore {
|
||
color: #cccccc;
|
||
}
|
||
}
|
||
|
||
.log-item-box {
|
||
min-height: 88rpx;
|
||
padding: 16rpx 0;
|
||
border-bottom: 1rpx solid $brand-border;
|
||
|
||
&:last-of-type {
|
||
border-bottom: none;
|
||
}
|
||
|
||
.log-item {
|
||
overflow: hidden;
|
||
margin-right: 16rpx;
|
||
}
|
||
|
||
.log-img {
|
||
width: 56rpx;
|
||
height: 56rpx;
|
||
border-radius: 50%;
|
||
margin-right: 16rpx;
|
||
flex-shrink: 0;
|
||
background: $brand-gold-light;
|
||
}
|
||
|
||
.log-text {
|
||
font-size: 26rpx;
|
||
font-weight: 400;
|
||
color: $brand-text;
|
||
line-height: 36rpx;
|
||
}
|
||
|
||
.log-time {
|
||
font-size: 22rpx;
|
||
font-weight: 400;
|
||
color: $brand-text-muted;
|
||
flex-shrink: 0;
|
||
white-space: nowrap;
|
||
}
|
||
}
|
||
}
|
||
|
||
// 功能菜单
|
||
.menu-box {
|
||
margin-bottom: $brand-section-gap;
|
||
padding: 28rpx 16rpx 8rpx;
|
||
|
||
.menu-grid {
|
||
margin: 0 -8rpx;
|
||
}
|
||
|
||
.menu-item {
|
||
width: 25%;
|
||
padding: 16rpx 8rpx 24rpx;
|
||
box-sizing: border-box;
|
||
min-height: 160rpx;
|
||
|
||
.item-icon-wrap {
|
||
width: 96rpx;
|
||
height: 96rpx;
|
||
border-radius: 24rpx;
|
||
background: $brand-gold-light;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
margin-bottom: 12rpx;
|
||
}
|
||
|
||
.item-img {
|
||
width: 52rpx;
|
||
height: 52rpx;
|
||
}
|
||
|
||
.item-title {
|
||
font-size: 24rpx;
|
||
font-weight: 500;
|
||
color: $brand-text;
|
||
line-height: 34rpx;
|
||
text-align: center;
|
||
}
|
||
}
|
||
}
|
||
|
||
// 进度条
|
||
.progress-box {
|
||
.progress-tip {
|
||
font-size: 24rpx;
|
||
font-weight: 500;
|
||
color: $brand-gold;
|
||
}
|
||
|
||
.progress-num {
|
||
font-size: 24rpx;
|
||
position: absolute;
|
||
color: $brand-gold;
|
||
bottom: -30rpx;
|
||
white-space: nowrap;
|
||
}
|
||
|
||
.round-wrap {
|
||
width: 30rpx;
|
||
height: 30rpx;
|
||
border: 2rpx solid $brand-gold;
|
||
background: #fff;
|
||
border-radius: 50%;
|
||
position: absolute;
|
||
bottom: -6rpx;
|
||
transform: translateY(-50%);
|
||
left: 0;
|
||
margin-left: -15rpx;
|
||
|
||
.round-inner {
|
||
width: 20rpx;
|
||
height: 20rpx;
|
||
border: 2rpx solid $brand-gold;
|
||
background: #fff;
|
||
border-radius: 50%;
|
||
position: absolute;
|
||
top: 50%;
|
||
left: 50%;
|
||
transform: translate(-50%, -50%);
|
||
}
|
||
}
|
||
}
|
||
|
||
.blur {
|
||
filter: blur(20rpx);
|
||
transition: all 0.3s ease-in-out;
|
||
}
|
||
|
||
.auth-box {
|
||
width: 100%;
|
||
height: 100%;
|
||
background: none;
|
||
|
||
.notice-box {
|
||
display: flex;
|
||
flex-direction: column;
|
||
justify-content: center;
|
||
align-items: center;
|
||
width: 612rpx;
|
||
min-height: 658rpx;
|
||
background: #ffffff;
|
||
padding: 30rpx;
|
||
border-radius: 20rpx;
|
||
|
||
.img-wrap {
|
||
margin-bottom: 50rpx;
|
||
|
||
.notice-img {
|
||
width: 180rpx;
|
||
height: 170rpx;
|
||
}
|
||
}
|
||
|
||
.notice-title {
|
||
font-size: 35rpx;
|
||
font-weight: bold;
|
||
color: $brand-text;
|
||
margin-bottom: 28rpx;
|
||
}
|
||
|
||
.notice-detail {
|
||
font-size: 28rpx;
|
||
font-weight: 400;
|
||
color: $brand-text-muted;
|
||
line-height: 36rpx;
|
||
margin-bottom: 50rpx;
|
||
}
|
||
|
||
.notice-btn {
|
||
width: 492rpx;
|
||
line-height: 70rpx;
|
||
background: $brand-gold-gradient;
|
||
box-shadow: 0 4rpx 12rpx rgba(22, 119, 255, 0.35);
|
||
border-radius: 35rpx;
|
||
font-size: 28rpx;
|
||
font-weight: 500;
|
||
color: #ffffff;
|
||
margin-bottom: 10rpx;
|
||
}
|
||
|
||
.regional-agent-btn {
|
||
width: 492rpx;
|
||
line-height: 70rpx;
|
||
border: 1rpx solid #1677FF;
|
||
border-radius: 35rpx;
|
||
font-size: 28rpx;
|
||
font-weight: 500;
|
||
color: #1677FF;
|
||
background: #fff;
|
||
margin-bottom: 10rpx;
|
||
}
|
||
|
||
.back-btn {
|
||
width: 492rpx;
|
||
line-height: 70rpx;
|
||
font-size: 28rpx;
|
||
font-weight: 500;
|
||
color: $brand-text-muted;
|
||
background: none;
|
||
}
|
||
}
|
||
}
|
||
|
||
.into-agent-modal {
|
||
.condition-box {
|
||
width: 640rpx;
|
||
height: 786rpx;
|
||
background-size: 100% 100%;
|
||
}
|
||
|
||
.goods-condition {
|
||
width: 484rpx;
|
||
height: 580rpx;
|
||
padding: 80rpx 0 30rpx;
|
||
display: flex;
|
||
flex-direction: column;
|
||
justify-content: center;
|
||
align-items: center;
|
||
position: relative;
|
||
|
||
.card-wrap {
|
||
width: 484rpx;
|
||
height: 460rpx;
|
||
padding: 10rpx;
|
||
padding-bottom: 30rpx;
|
||
}
|
||
|
||
.modal-progress {
|
||
.progress-tip {
|
||
font-size: 24rpx;
|
||
}
|
||
|
||
.progress-box {
|
||
margin-right: 10rpx;
|
||
|
||
.cu-progress {
|
||
width: 200rpx;
|
||
position: relative;
|
||
|
||
.round-wrap {
|
||
width: 20rpx;
|
||
height: 20rpx;
|
||
}
|
||
|
||
.round-inner {
|
||
width: 10rpx;
|
||
height: 10rpx;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
.card-box {
|
||
background: rgba($brand-gold, 0.12);
|
||
padding: 10rpx;
|
||
border-radius: $brand-card-radius;
|
||
|
||
.img-wrap {
|
||
background: #fff;
|
||
width: 110rpx;
|
||
height: 110rpx;
|
||
border-radius: 10rpx;
|
||
margin-right: 20rpx;
|
||
|
||
.goods-img {
|
||
width: 110rpx;
|
||
height: 110rpx;
|
||
border-radius: 10rpx;
|
||
}
|
||
}
|
||
|
||
.detail {
|
||
height: 110rpx;
|
||
width: 280rpx;
|
||
align-items: flex-start;
|
||
|
||
.title {
|
||
font-size: 20rpx;
|
||
font-weight: 500;
|
||
color: $brand-text;
|
||
line-height: 35rpx;
|
||
text-align: left;
|
||
}
|
||
|
||
.sub {
|
||
font-size: 16rpx;
|
||
font-weight: 500;
|
||
color: $brand-gold;
|
||
text-align: left;
|
||
width: 280rpx;
|
||
}
|
||
}
|
||
}
|
||
|
||
.filter-card {
|
||
filter: grayscale(100%);
|
||
}
|
||
|
||
.btn-box {
|
||
background-color: #fff;
|
||
width: 100%;
|
||
position: absolute;
|
||
bottom: 0;
|
||
|
||
.buy-btn {
|
||
width: 390rpx;
|
||
line-height: 60rpx;
|
||
background: $brand-gold-gradient;
|
||
box-shadow: 0 4rpx 12rpx rgba(22, 119, 255, 0.35);
|
||
border-radius: 35rpx;
|
||
font-size: 24rpx;
|
||
font-weight: 500;
|
||
color: #ffffff;
|
||
}
|
||
|
||
.regional-link-btn {
|
||
width: 390rpx;
|
||
line-height: 60rpx;
|
||
border: 1rpx solid #1677FF;
|
||
border-radius: 35rpx;
|
||
font-size: 24rpx;
|
||
font-weight: 500;
|
||
color: #1677FF;
|
||
background: #fff;
|
||
}
|
||
|
||
.tips {
|
||
font-size: 20rpx;
|
||
font-weight: 500;
|
||
color: $brand-text-muted;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
</style>
|