优化分销中心分享进来后的返回
This commit is contained in:
@@ -26,12 +26,15 @@
|
||||
<text class="color-333 font-700 u-m-r-6" v-if="state.distributionUser">
|
||||
{{ state.distributionUser.level }}级 {{ state.distributionUser.levelName }}
|
||||
</text>
|
||||
<up-icon name="question-circle" size="24rpx" color="#666" @click="questionClick('等级升级条件')" />
|
||||
<up-icon name="question-circle" size="24rpx" color="#666"
|
||||
@click="questionClick('等级升级条件')" />
|
||||
</view>
|
||||
<view class="u-m-t-28 u-flex align-center" v-if="juNextLvMoney && state.distributionUser && state.distributionUser.isAssignLevel == 0">
|
||||
<view class="u-m-t-28 u-flex align-center"
|
||||
v-if="juNextLvMoney && state.distributionUser && state.distributionUser.isAssignLevel == 0">
|
||||
<text class="color-666">距离下一级还差:</text>
|
||||
<text class="color-333 font-700 u-m-r-18">{{ juNextLvMoney }}</text>
|
||||
<text class="color-333 font-700 u-m-r-18">{{ config.upgradeType == 'cost' ? '元' : '人' }}</text>
|
||||
<text class="color-333 font-700 u-m-r-18">{{ config.upgradeType == 'cost' ? '元' : '人'
|
||||
}}</text>
|
||||
<!-- <up-icon
|
||||
name="question-circle"
|
||||
size="24rpx"
|
||||
@@ -43,16 +46,22 @@
|
||||
<view class="u-flex-1">
|
||||
<view class="u-flex align-center">
|
||||
<text class="u-m-r-10 font-12 color-666" @click="toShouyiDetail('')">总收益</text>
|
||||
<up-icon name="question-circle" size="24rpx" color="#666" @click="questionClick('总收益')" />
|
||||
<up-icon name="question-circle" size="24rpx" color="#666"
|
||||
@click="questionClick('总收益')" />
|
||||
</view>
|
||||
<view class="u-m-t-16 price" @click="toShouyiDetail('')" v-if="state.distributionUser">{{ state.distributionUser.totalIncome }}</view>
|
||||
<view class="u-m-t-16 price" @click="toShouyiDetail('')" v-if="state.distributionUser">
|
||||
{{
|
||||
state.distributionUser.totalIncome }}</view>
|
||||
</view>
|
||||
<view class="u-flex-1">
|
||||
<view class="u-flex align-center">
|
||||
<text class="u-m-r-10 font-12 color-666" @click="toShouyiDetail('待入账')">待入账</text>
|
||||
<up-icon name="question-circle" size="24rpx" color="#666" @click="questionClick('待入账')" />
|
||||
<up-icon name="question-circle" size="24rpx" color="#666"
|
||||
@click="questionClick('待入账')" />
|
||||
</view>
|
||||
<view class="u-m-t-16 price" @click="toShouyiDetail('待入账')" v-if="state.distributionUser">{{ state.distributionUser.pendingIncome }}</view>
|
||||
<view class="u-m-t-16 price" @click="toShouyiDetail('待入账')"
|
||||
v-if="state.distributionUser">{{
|
||||
state.distributionUser.pendingIncome }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -64,7 +73,8 @@
|
||||
<view class="u-m-t-16 color-666 font-14">
|
||||
<view>需要邀请人数:{{ config.inviteCount }}人</view>
|
||||
<view>是否需要邀请人数下单:{{ config.inviteConsume ? '是' : '否' }}</view>
|
||||
<view>每人可获得的分销奖励次数:{{ config.rewardCount == -1 ? '永久' : config.rewardCount + '次' }}</view>
|
||||
<view>每人可获得的分销奖励次数:{{ config.rewardCount == -1 ? '永久' : config.rewardCount + '次' }}
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<template v-if="config.openType == 'pay'">
|
||||
@@ -97,8 +107,11 @@
|
||||
</view>
|
||||
|
||||
<view class="tabs" v-if="false">
|
||||
<view class="tabs-item" :class="{ active: activeTab == 'distributor' }" @click="activeTab = 'distributor'">分销员</view>
|
||||
<view class="tabs-item" :class="{ active: activeTab == 'inviter' }" @click="activeTab = 'inviter'">邀请人</view>
|
||||
<view class="tabs-item" :class="{ active: activeTab == 'distributor' }"
|
||||
@click="activeTab = 'distributor'">分销员
|
||||
</view>
|
||||
<view class="tabs-item" :class="{ active: activeTab == 'inviter' }" @click="activeTab = 'inviter'">邀请人
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="u-m-t-48 font-14">
|
||||
@@ -108,7 +121,8 @@
|
||||
<view>邀请时间</view>
|
||||
</view>
|
||||
<view class="u-m-t-16">
|
||||
<view v-for="(item, index) in userList" :key="index" class="u-flex justify-between align-center recoder-item color-666 font-12">
|
||||
<view v-for="(item, index) in userList" :key="index"
|
||||
class="u-flex justify-between align-center recoder-item color-666 font-12">
|
||||
<view class="">
|
||||
<view class="u-line-1" style="max-width: 160rpx">
|
||||
<text>
|
||||
@@ -144,7 +158,8 @@
|
||||
<view>我的收益什么时候可以到账?</view>
|
||||
<view>分销的结算时长为{{ config.settlementDay || 0 }}天</view>
|
||||
</view>
|
||||
<template v-if="config.upgradeType != 'not_upgrade' && config.levelConfigList && config.levelConfigList.length >= 2">
|
||||
<template
|
||||
v-if="config.upgradeType != 'not_upgrade' && config.levelConfigList && config.levelConfigList.length >= 2">
|
||||
<view class="u-m-t-40">
|
||||
<view>怎么样才能升级分销员等级?</view>
|
||||
|
||||
@@ -176,7 +191,9 @@
|
||||
<view style="height: 240rpx"></view>
|
||||
</template>
|
||||
|
||||
<view class="tips u-m-t-32" v-if="state.distributionUser && state.distributionUser.status">您的分销员身份已取消,不再获得分成有疑问可联系商家</view>
|
||||
<view class="tips u-m-t-32" v-if="state.distributionUser && state.distributionUser.status">
|
||||
您的分销员身份已取消,不再获得分成有疑问可联系商家
|
||||
</view>
|
||||
|
||||
<view class="u-flex justify-center bottom-btn" v-if="showInviteCode">
|
||||
<view class="copy" @click="copyCode">
|
||||
@@ -188,18 +205,20 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="buy" v-if="config.openType == 'pay' && config.payAmount && !isActivated" @click="buy">付费{{ config.payAmount }}元开通</view>
|
||||
<view class="buy" v-if="config.openType == 'pay' && config.payAmount && !isActivated" @click="buy">付费{{
|
||||
config.payAmount
|
||||
}}元开通</view>
|
||||
|
||||
<bindShangji v-model="showBindShangji" @confirm="confirmBindShangji"></bindShangji>
|
||||
<sharePopup
|
||||
v-model="showSharePopup"
|
||||
<sharePopup v-model="showSharePopup"
|
||||
v-if="(state.distributionUser && state.distributionUser.inviteCode) || inviteCode"
|
||||
:inviteCode="state.distributionUser ? state.distributionUser.inviteCode : inviteCode"
|
||||
:shopUserInfo="shopUserInfo"
|
||||
></sharePopup>
|
||||
:shopUserInfo="shopUserInfo">
|
||||
</sharePopup>
|
||||
|
||||
<TipsPopup v-model="showPopup" :tips-type="tipsType"></TipsPopup>
|
||||
<commissionPopup :tipsType="commissionTipsType" v-model="showCommission" :config="config" :levelConfigList="config.levelConfigList || []"></commissionPopup>
|
||||
<commissionPopup :tipsType="commissionTipsType" v-model="showCommission" :config="config"
|
||||
:levelConfigList="config.levelConfigList || []"></commissionPopup>
|
||||
<rulePopup v-model="showRule" :config="config" :distributionUser="state.distributionUser"></rulePopup>
|
||||
</view>
|
||||
</template>
|
||||
@@ -252,9 +271,81 @@ function questionClick(title) {
|
||||
}
|
||||
}
|
||||
function back() {
|
||||
uni.navigateBack({
|
||||
delta: 1
|
||||
// uni.navigateBack({
|
||||
// delta: 1
|
||||
// });
|
||||
safeNavigateBack()
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 修复版:安全的页面返回方法
|
||||
* 彻底避免 "cannot navigate back at first page" 报错
|
||||
* @param {Number} delta 返回的页面数,默认1
|
||||
* @param {Function} fallback 失败时的降级处理函数
|
||||
*/
|
||||
function safeNavigateBack(delta = 1, fallback) {
|
||||
// 1. 立即获取页面栈,确保拿到最新状态(关键修复点)
|
||||
const pages = getCurrentPages();
|
||||
// 2. 严谨判断:页面栈长度必须大于 delta 才能返回
|
||||
const canNavigateBack = pages.length > delta;
|
||||
|
||||
console.log('页面栈信息:', {
|
||||
pagesLength: pages.length,
|
||||
delta: delta,
|
||||
canNavigateBack: canNavigateBack
|
||||
});
|
||||
|
||||
// 3. 如果不能返回,直接执行降级逻辑
|
||||
if (!canNavigateBack) {
|
||||
console.warn('当前是首页/页面栈不足,无法返回');
|
||||
handleFallback(fallback);
|
||||
return; // 终止后续执行,彻底避免调用 navigateBack
|
||||
}
|
||||
|
||||
// 4. 能返回时才执行 navigateBack
|
||||
try {
|
||||
uni.navigateBack({
|
||||
delta: delta,
|
||||
success: () => {
|
||||
console.log('页面返回成功');
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('navigateBack 执行失败:', err);
|
||||
handleFallback(fallback);
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('页面返回异常:', error);
|
||||
handleFallback(fallback);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 统一处理降级逻辑
|
||||
* @param {Function} fallback 自定义降级函数
|
||||
*/
|
||||
function handleFallback(fallback) {
|
||||
if (typeof fallback === 'function') {
|
||||
fallback(); // 执行自定义降级
|
||||
} else {
|
||||
// 默认降级:返回首页(请替换为你的首页路径)
|
||||
uni.showToast({
|
||||
title: '已到首页,无法返回',
|
||||
icon: 'none',
|
||||
duration: 1500
|
||||
});
|
||||
|
||||
// 如果需要强制跳首页,解开下面注释(根据你的业务选择)
|
||||
uni.switchTab({
|
||||
url: '/pages/index/index',
|
||||
fail: () => {
|
||||
uni.redirectTo({
|
||||
url: '/pages/index/index'
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
async function confirmBindShangji(code) {
|
||||
@@ -526,10 +617,12 @@ onReachBottom(async () => {
|
||||
border-bottom: 1px solid #999;
|
||||
font-size: 28rpx;
|
||||
align-items: baseline;
|
||||
|
||||
.fuhao {
|
||||
font-size: 64rpx;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.input-number {
|
||||
flex: 1;
|
||||
height: 100%;
|
||||
@@ -538,11 +631,13 @@ onReachBottom(async () => {
|
||||
padding-left: 24rpx;
|
||||
padding-right: 10rpx;
|
||||
}
|
||||
|
||||
.all-in {
|
||||
font-size: 28rpx;
|
||||
color: #fe7e00;
|
||||
}
|
||||
}
|
||||
|
||||
.list {
|
||||
.shop-item {
|
||||
padding: 32rpx 28rpx;
|
||||
@@ -551,12 +646,15 @@ onReachBottom(async () => {
|
||||
color: #666;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
&:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.fufei {
|
||||
color: #e8ad7b;
|
||||
}
|
||||
|
||||
.tag {
|
||||
font-size: 24rpx;
|
||||
color: #ff1c1c;
|
||||
@@ -564,12 +662,14 @@ onReachBottom(async () => {
|
||||
padding: 8rpx 20rpx;
|
||||
border-radius: 8rpx;
|
||||
}
|
||||
|
||||
.name {
|
||||
color: #333;
|
||||
font-weight: 700;
|
||||
}
|
||||
.shouxufei {
|
||||
}
|
||||
|
||||
.shouxufei {}
|
||||
|
||||
.shouyi {
|
||||
font-size: 24rpx;
|
||||
color: #666;
|
||||
@@ -577,15 +677,18 @@ onReachBottom(async () => {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.status {
|
||||
font-size: 28rpx;
|
||||
font-weight: 700;
|
||||
text-align: right;
|
||||
color: #333333;
|
||||
|
||||
&.fail {
|
||||
color: #ff1c1c;
|
||||
}
|
||||
}
|
||||
|
||||
.lingqu {
|
||||
font-size: 28rpx;
|
||||
border-radius: 8rpx;
|
||||
@@ -593,23 +696,28 @@ onReachBottom(async () => {
|
||||
padding: 8rpx 16rpx;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.price {
|
||||
font-weight: 700;
|
||||
font-size: 40rpx;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.top {
|
||||
position: relative;
|
||||
|
||||
.box {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
padding: 28rpx 28rpx 52rpx 28rpx;
|
||||
|
||||
&.type1 {
|
||||
padding-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.top_content {
|
||||
border: 1px solid rgba(255, 255, 255, 0.8);
|
||||
border-radius: 16rpx;
|
||||
@@ -620,6 +728,7 @@ onReachBottom(async () => {
|
||||
stroke: #fff;
|
||||
filter: drop-shadow(2rpx -4rpx 13.4rpx #ff6f0124);
|
||||
backdrop-filter: blur(5.1rpx);
|
||||
|
||||
&.type1 {
|
||||
filter: none;
|
||||
border: none;
|
||||
@@ -629,25 +738,30 @@ onReachBottom(async () => {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.btn-group {
|
||||
position: absolute;
|
||||
right: 28rpx;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
|
||||
.btn {
|
||||
padding: 8rpx 16rpx;
|
||||
border-radius: 8rpx;
|
||||
font-size: 24rpx;
|
||||
border: 2rpx solid #fe6d11;
|
||||
|
||||
&.shiming {
|
||||
color: #fe6d11;
|
||||
}
|
||||
|
||||
&.tixian {
|
||||
color: #fff;
|
||||
background-color: #fe6d11;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.tips {
|
||||
padding: 16rpx 18rpx;
|
||||
background: #ffe2e2;
|
||||
@@ -656,6 +770,7 @@ onReachBottom(async () => {
|
||||
line-height: 48rpx;
|
||||
color: #ff1c1c;
|
||||
}
|
||||
|
||||
.bind {
|
||||
padding: 8rpx 32rpx;
|
||||
border-radius: 8rpx;
|
||||
@@ -664,39 +779,47 @@ onReachBottom(async () => {
|
||||
color: #fff;
|
||||
background-color: #fe6d11;
|
||||
}
|
||||
|
||||
.top_bg {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.bottom {
|
||||
margin: 0 28rpx;
|
||||
border-radius: 36rpx;
|
||||
background-color: #fff;
|
||||
transform: translateY(-20rpx);
|
||||
padding: 32rpx 28rpx;
|
||||
|
||||
&.type1 {
|
||||
transform: translateY(0);
|
||||
margin: 0;
|
||||
padding-bottom: 42rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 32rpx;
|
||||
font-weight: 700;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.small-title {
|
||||
font-size: 28rpx;
|
||||
font-weight: 700;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.parse-html {
|
||||
margin: 32rpx 28rpx;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
.recoder-item {
|
||||
padding: 16rpx 0;
|
||||
border-bottom: 2rpx solid #ededed;
|
||||
}
|
||||
|
||||
.share {
|
||||
border-radius: 16rpx;
|
||||
background: #e8ad7b;
|
||||
@@ -705,6 +828,7 @@ onReachBottom(async () => {
|
||||
line-height: 48rpx;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.copy {
|
||||
padding: 4rpx 30rpx;
|
||||
border-radius: 18rpx;
|
||||
@@ -715,6 +839,7 @@ onReachBottom(async () => {
|
||||
line-height: 48rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.bottom-btn {
|
||||
position: fixed;
|
||||
left: 84rpx;
|
||||
@@ -723,6 +848,7 @@ onReachBottom(async () => {
|
||||
white-space: nowrap;
|
||||
gap: 54rpx;
|
||||
}
|
||||
|
||||
.buy {
|
||||
padding: 32rpx 224rpx;
|
||||
border-radius: 40rpx;
|
||||
@@ -737,10 +863,12 @@ onReachBottom(async () => {
|
||||
bottom: 62rpx;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.tabs {
|
||||
display: flex;
|
||||
margin: 20rpx 0;
|
||||
gap: 30rpx;
|
||||
|
||||
.tabs-item {
|
||||
flex: 1;
|
||||
padding: 4rpx 30rpx;
|
||||
@@ -752,6 +880,7 @@ onReachBottom(async () => {
|
||||
line-height: 48rpx;
|
||||
text-align: center;
|
||||
transition: all 0.3s ease-in-out;
|
||||
|
||||
&.active {
|
||||
background-color: #e8ad7b;
|
||||
color: #fff;
|
||||
|
||||
Reference in New Issue
Block a user