【优化】(个人中心):点击代理分销请求接口后跳转

This commit is contained in:
15093570141
2024-10-17 21:24:59 +08:00
parent 71676cae8c
commit db2cad6b90
3 changed files with 75 additions and 24 deletions

View File

@@ -26,8 +26,8 @@
padding-bottom: calc(env(safe-area-inset-bottom) / 2);
.btn {
width: 100%;
padding: 20rpx;
width: calc(100% - 40rpx);
margin: 20rpx;
}
}
</style>

View File

@@ -112,7 +112,7 @@
<view class="tit">商家管理</view>
</view>
<template v-for="item in navState.myServiceList" :key="item.name">
<view class="item" v-if="item.isShow" @click="handleJumpPage(item.url)">
<view class="item" v-if="item.isShow" @click="handleMyServiceJumpPage(item)">
<image class="img" :src="handleStaticResources(item.img)"></image>
<view class="tit">{{ item.title }}</view>
</view>
@@ -152,10 +152,10 @@
import { reactive } from 'vue';
import { onPageScroll, onShow } from '@dcloudio/uni-app';
import { handleStaticResources, handleRouteNavigateTo, handleShowToast } from '@/core/utils';
import { queryUserInfo, queryOrderStatusNum, queryUserIsClerk } from '@/core/api';
import { queryUserInfo, queryOrderStatusNum, queryUserIsClerk, queryDistributionInfo, queryAgentInfo } from '@/core/api';
import type { Response, MemberOrderType, UserInfoType, UserIsClerkType, MemberServiceType } from '@/core/models';
import { useShopConfigStore, useUserInfoStore, useLoginStore } from '@/core/store';
import { ShowVasEnum, ShowInviterEnum, OrderTabStatusEnum, MemberPageNameEnum } from '@/core/enum';
import { ShowVasEnum, ShowInviterEnum, OrderTabStatusEnum, MemberPageNameEnum, DistributionApplyStatus, AgentApplyStatus } from '@/core/enum';
import { useNavHook } from './use-nav-hook';
import { UserToken } from '@/core/consts'
@@ -247,6 +247,45 @@
});
}
/** 我的服务跳转页面 */
const handleMyServiceJumpPage = (item : MemberServiceType) => {
_useLoginStore.checkLogin(async () => {
/** 判断分销 获取分销商进度状态 */
if (item.name == MemberPageNameEnum.distribution) {
const info : Response<any> = await queryDistributionInfo();
if (info.status) {
if (info.data?.verifyStatus == DistributionApplyStatus.success || (!info.data?.needApply && info.data?.conditionStatus)) {
handleRouteNavigateTo('/pages/subpackage/distribution/index/index');
} else if (info.data?.verifyStatus > DistributionApplyStatus.success) {
handleRouteNavigateTo(`/pages/subpackage/distribution/apply/state`);
} else {
handleRouteNavigateTo(`/pages/subpackage/distribution/apply/index`);
}
} else {
handleShowToast(info.msg)
}
return;
}
/** 判断代理 获取代理商进度状态 */
if (item.name == MemberPageNameEnum.agent) {
const info : Response<any> = await queryAgentInfo({ check_condition: true });
if (info.status) {
if (info.data?.verifyStatus == AgentApplyStatus.success || (!info.data?.needApply && info.data?.conditionStatus)) {
handleRouteNavigateTo('/pages/subpackage/agency/index/index');
} else if (info.data?.verifyStatus > AgentApplyStatus.success) {
handleRouteNavigateTo(`/pages/subpackage/agency/apply/state`);
} else {
handleRouteNavigateTo(`/pages/subpackage/agency/apply/index`);
}
} else {
handleShowToast(info.msg)
}
return;
}
handleRouteNavigateTo(item.url);
});
}
/** 分类服务跳转页面 */
const handleClassifyServiceJumpPage = (item : MemberServiceType) => {
/** 判断签到,系统设置 */

View File

@@ -138,7 +138,8 @@
v-if="state.userCouponsList.length > 0 && state.orderType === PaymentTypeEnum.common && shopConfigStore.config.showCoupon === ShowCouponEnum.yes">
<view class="title-box">
<view class="title">优惠券</view>
<view class="desc" v-if="state.couponCodeList.length > 0" @click="handleCancelSelectCoupop">取消选择</view>
<view class="desc" v-if="state.couponCodeList.length > 0" @click="handleCancelSelectCoupop">取消选择
</view>
</view>
<view class="list-box">
<scroll-view class="coupon-scroll" scroll-x>
@@ -390,8 +391,13 @@
await getUserDefaultShip();
});
interface CartListCallBack {
success : Function,
file : Function,
}
/** 获取商品详情 */
const getCartList = async (callBack ?: (data : any) => void) => {
const getCartList = async (data ?: CartListCallBack) => {
uni.showLoading({
title: '加载中'
});
@@ -421,9 +427,10 @@
if (shopConfigStore.config.pointSwitch === OpenPointEnum.yes && !state.isUsePoint) {
getUserPoint(cartList?.data?.amount)
}
data?.success(cartList);
} else {
uni.hideLoading();
callBack(cartList);
data?.file(cartList);
}
}
@@ -499,18 +506,23 @@
handleShowToast('请在有效时间内使用');
return;
}
if (state.couponCodeList.includes(item.couponCode)) {
item.checked = false;
state.couponCodeList.splice(state.couponCodeList.findIndex((cell) => cell == item.couponCode), 1);
} else {
item.checked = true;
state.couponCodeList.push(item.couponCode);
}
getCartList((data : any) => {
getCartList({
success() {
item.checked = !item.checked;
},
file(data : any) {
handleShowToast(data.msg);
state.couponCodeList.splice(state.couponCodeList.findIndex((cell) => cell == item.couponCode), 1);
item.checked = false;
});
}
})
}
/** 获取默认店铺 */