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

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

@@ -25,9 +25,9 @@
justify-content: space-between; justify-content: space-between;
padding-bottom: calc(env(safe-area-inset-bottom) / 2); padding-bottom: calc(env(safe-area-inset-bottom) / 2);
.btn { .btn {
width: 100%; width: calc(100% - 40rpx);
padding: 20rpx; margin: 20rpx;
} }
} }
</style> </style>

View File

@@ -2,7 +2,7 @@
<coreshop-page :title="state.isScrollToTop ? '' : userInfoStore.userInfo?.nickName || ''" titleColor="#fff" <coreshop-page :title="state.isScrollToTop ? '' : userInfoStore.userInfo?.nickName || ''" titleColor="#fff"
mode="left" :bgColor=" state.isScrollToTop ? 'rgba(0,0,0,0)':'#d33123'" :isShowStatusBarHeight="false" mode="left" :bgColor=" state.isScrollToTop ? 'rgba(0,0,0,0)':'#d33123'" :isShowStatusBarHeight="false"
:isBack="false" showLoginModalDom> :isBack="false" showLoginModalDom>
<view class="layout-member-page"> <view class="layout-member-page">
<view class="member-head"> <view class="member-head">
<image class="memeber-bg" src="/static/images/member/bg.png"></image> <image class="memeber-bg" src="/static/images/member/bg.png"></image>
<view class="head-box m-b-10"> <view class="head-box m-b-10">
@@ -48,7 +48,7 @@
<view class="tit">售后</view> <view class="tit">售后</view>
</view> </view>
</view> </view>
<view class="member-box"> <view class="member-box">
<view class="member-content"> <view class="member-content">
<view class="content"> <view class="content">
<view class="grade">{{ userInfoStore.userInfo?.gradeName || '普通会员' }}</view> <view class="grade">{{ userInfoStore.userInfo?.gradeName || '普通会员' }}</view>
@@ -64,7 +64,7 @@
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<view class="p-20"> <view class="p-20">
<!-- 我的订单 --> <!-- 我的订单 -->
<view class="view-box"> <view class="view-box">
@@ -112,7 +112,7 @@
<view class="tit">商家管理</view> <view class="tit">商家管理</view>
</view> </view>
<template v-for="item in navState.myServiceList" :key="item.name"> <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> <image class="img" :src="handleStaticResources(item.img)"></image>
<view class="tit">{{ item.title }}</view> <view class="tit">{{ item.title }}</view>
</view> </view>
@@ -152,10 +152,10 @@
import { reactive } from 'vue'; import { reactive } from 'vue';
import { onPageScroll, onShow } from '@dcloudio/uni-app'; import { onPageScroll, onShow } from '@dcloudio/uni-app';
import { handleStaticResources, handleRouteNavigateTo, handleShowToast } from '@/core/utils'; 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 type { Response, MemberOrderType, UserInfoType, UserIsClerkType, MemberServiceType } from '@/core/models';
import { useShopConfigStore, useUserInfoStore, useLoginStore } from '@/core/store'; 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 { useNavHook } from './use-nav-hook';
import { UserToken } from '@/core/consts' 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) => { 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"> v-if="state.userCouponsList.length > 0 && state.orderType === PaymentTypeEnum.common && shopConfigStore.config.showCoupon === ShowCouponEnum.yes">
<view class="title-box"> <view class="title-box">
<view class="title">优惠券</view> <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>
<view class="list-box"> <view class="list-box">
<scroll-view class="coupon-scroll" scroll-x> <scroll-view class="coupon-scroll" scroll-x>
@@ -390,8 +391,13 @@
await getUserDefaultShip(); await getUserDefaultShip();
}); });
interface CartListCallBack {
success : Function,
file : Function,
}
/** 获取商品详情 */ /** 获取商品详情 */
const getCartList = async (callBack ?: (data : any) => void) => { const getCartList = async (data ?: CartListCallBack) => {
uni.showLoading({ uni.showLoading({
title: '加载中' title: '加载中'
}); });
@@ -421,9 +427,10 @@
if (shopConfigStore.config.pointSwitch === OpenPointEnum.yes && !state.isUsePoint) { if (shopConfigStore.config.pointSwitch === OpenPointEnum.yes && !state.isUsePoint) {
getUserPoint(cartList?.data?.amount) getUserPoint(cartList?.data?.amount)
} }
data?.success(cartList);
} else { } else {
uni.hideLoading(); uni.hideLoading();
callBack(cartList); data?.file(cartList);
} }
} }
@@ -495,22 +502,27 @@
/** 选择使用优惠券 */ /** 选择使用优惠券 */
const handleSelectCoupop = (item : any) => { const handleSelectCoupop = (item : any) => {
if(!item.disabled){ if (!item.disabled) {
handleShowToast('请在有效时间内使用'); handleShowToast('请在有效时间内使用');
return ; return;
} }
if(state.couponCodeList.includes(item.couponCode)){
item.checked = false; if (state.couponCodeList.includes(item.couponCode)) {
state.couponCodeList.splice(state.couponCodeList.findIndex((cell) => cell == item.couponCode), 1); state.couponCodeList.splice(state.couponCodeList.findIndex((cell) => cell == item.couponCode), 1);
}else{ } else {
item.checked = true;
state.couponCodeList.push(item.couponCode); state.couponCodeList.push(item.couponCode);
} }
getCartList((data : any) => {
handleShowToast(data.msg); getCartList({
state.couponCodeList.splice(state.couponCodeList.findIndex((cell) => cell == item.couponCode), 1); success() {
item.checked = false; item.checked = !item.checked;
}); },
file(data : any) {
handleShowToast(data.msg);
state.couponCodeList.splice(state.couponCodeList.findIndex((cell) => cell == item.couponCode), 1);
item.checked = false;
}
})
} }
/** 获取默认店铺 */ /** 获取默认店铺 */