wip
This commit is contained in:
parent
ed99c7b1ae
commit
6805b590c7
@ -16,7 +16,19 @@
|
||||
"coverView": false,
|
||||
"showShadowRootInWxmlPanel": false,
|
||||
"packNpmRelationList": [],
|
||||
"ignoreUploadUnusedFiles": true
|
||||
"ignoreUploadUnusedFiles": true,
|
||||
"compileWorklet": false,
|
||||
"uglifyFileName": false,
|
||||
"uploadWithSourceMap": true,
|
||||
"packNpmManually": false,
|
||||
"minifyWXSS": true,
|
||||
"minifyWXML": true,
|
||||
"localPlugins": false,
|
||||
"disableUseStrict": false,
|
||||
"useCompilerPlugins": false,
|
||||
"condition": false,
|
||||
"swc": false,
|
||||
"disableSWC": true
|
||||
},
|
||||
"compileType": "miniprogram",
|
||||
"srcMiniprogramRoot": "dist/",
|
||||
@ -30,5 +42,6 @@
|
||||
"ignore": [],
|
||||
"include": []
|
||||
},
|
||||
"appid": "wxf0724a83f8e377d2"
|
||||
"appid": "wxf0724a83f8e377d2",
|
||||
"simulatorPluginLibVersion": {}
|
||||
}
|
@ -7,16 +7,16 @@ import { REFRESH_UNREAD_COUNT_TIME } from '@/constants/message';
|
||||
import http from '@/http';
|
||||
import store from '@/store';
|
||||
import { requestUnreadMessageCount } from '@/utils/message';
|
||||
import { getInviteCode } from '@/utils/partner';
|
||||
import { getInviteCode, getInviteCodeFromQuery } from '@/utils/partner';
|
||||
import qiniuUpload from '@/utils/qiniu-upload';
|
||||
import { requestUserInfo, updateLastLoginTime } from '@/utils/user';
|
||||
|
||||
import './app.less';
|
||||
|
||||
function App({ children }: PropsWithChildren<BL.Anything>) {
|
||||
useLaunch(async () => {
|
||||
useLaunch(async ({ query }) => {
|
||||
console.log('App launched.');
|
||||
await http.init();
|
||||
await http.init(getInviteCodeFromQuery(query));
|
||||
requestUserInfo().then(userInfo => {
|
||||
if (userInfo.isPartner) {
|
||||
getInviteCode();
|
||||
|
@ -61,6 +61,10 @@
|
||||
font-weight: 400;
|
||||
font-size: 28px;
|
||||
line-height: 40px;
|
||||
|
||||
&.grey {
|
||||
color: @blColorG2
|
||||
}
|
||||
}
|
||||
|
||||
&__title {
|
||||
|
@ -142,12 +142,18 @@ export default function PartnerIntro() {
|
||||
</div>
|
||||
</div>
|
||||
<div className={`${PREFIX}__block`}>
|
||||
<div className={`${PREFIX}__title`}>群主特别通道</div>
|
||||
<div className={`${PREFIX}__title`}>分享方法</div>
|
||||
<div className={`${PREFIX}__card`}>
|
||||
<div className={`${PREFIX}__body`}>分享小程序任意页面到群、朋友圈、好友即可</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className={`${PREFIX}__block`}>
|
||||
<div className={`${PREFIX}__title`}>合伙人交流群</div>
|
||||
<div className={`${PREFIX}__card ${PREFIX}__special`}>
|
||||
<div className={`${PREFIX}__body`}>如果您是主播群群主,请务必添加播络小伙计</div>
|
||||
<div className={`${PREFIX}__body`}>我们会为您提供专属服务,让您的收益最大化</div>
|
||||
<div className={`${PREFIX}__h1`}>加入播络合伙人交流群</div>
|
||||
<div className={`${PREFIX}__body grey`}>学习分享邀请经验,一起赚钱</div>
|
||||
<Button className={`${PREFIX}__service`} onClick={handleOpenService}>
|
||||
点击添加播络伙计
|
||||
点击加入
|
||||
</Button>
|
||||
</div>
|
||||
<div className={`${PREFIX}__tip`}>注:收益不设时限,可重复享有,播络保留活动最终解释权</div>
|
||||
|
@ -41,14 +41,18 @@
|
||||
height: 131px;
|
||||
width: 100%;
|
||||
background: #fff;
|
||||
padding: 24px 32px;
|
||||
padding: 24px 32px 0 32px;
|
||||
box-sizing: border-box;
|
||||
font-size: 28px;
|
||||
|
||||
&-border {
|
||||
border-bottom: 1px solid #e6e7e8;
|
||||
}
|
||||
|
||||
&-content {
|
||||
.flex-row();
|
||||
width: 100%;
|
||||
border-bottom: 1px solid #e6e7e8;
|
||||
padding-bottom: 24px;
|
||||
}
|
||||
|
||||
&-time-id {
|
||||
|
@ -99,6 +99,7 @@ function PartnerList(props: {
|
||||
>
|
||||
{dataList.map(item => (
|
||||
<div className={`${PREFIX}__item`} key={item.id || item.userId}>
|
||||
<div className={`${PREFIX}__item-border`}>
|
||||
<div className={`${PREFIX}__item-content`}>
|
||||
<div className={`${PREFIX}__item-time-id`}>
|
||||
<div className={`${PREFIX}__item-time`}>{formatTimestamp(item.created)}</div>
|
||||
@ -108,6 +109,7 @@ function PartnerList(props: {
|
||||
<div className={`${PREFIX}__item-joined`}>{item.isPartner ? '已加入' : '未加入'}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
<ListPlaceholder hasMore={false} loadingMore={loadingMore} loadMoreError={loadMoreError} />
|
||||
</List>
|
||||
|
@ -96,7 +96,7 @@ function ProfitList(props: IPartnerProfitListProps) {
|
||||
style={listHeight ? { height: `${listHeight}px` } : undefined}
|
||||
>
|
||||
{dataList.map(item => {
|
||||
const isChat = type === ProfitType.CHAT_SHARE || item.earnType.toString().toLowerCase().indexOf('chat');
|
||||
const isChat = type === ProfitType.CHAT_SHARE || item.earnType.toString().toLowerCase().indexOf('chat') > -1;
|
||||
return (
|
||||
<div className={`${PREFIX}__row`} key={item.id}>
|
||||
<div className={`${PREFIX}__row-content`}>
|
||||
|
@ -28,6 +28,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
&__help-icon {
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
margin-left: 2px;
|
||||
position: relative;
|
||||
top: 6px;
|
||||
}
|
||||
|
||||
&__title {
|
||||
height: 72px;
|
||||
width: 100%;
|
||||
|
@ -1,7 +1,10 @@
|
||||
import { Image } from '@tarojs/components';
|
||||
|
||||
import { Tabs } from '@taroify/core';
|
||||
|
||||
import PartnerKanban from '@/components/partner-kanban';
|
||||
import { ProfitType } from '@/types/partner';
|
||||
import Toast from '@/utils/toast';
|
||||
|
||||
import ProfitList from './ProfitList';
|
||||
|
||||
@ -21,22 +24,64 @@ function TableTitle() {
|
||||
}
|
||||
|
||||
export default function PartnerProfit() {
|
||||
const handleClickHelpChat = () => {
|
||||
Toast.info('主播被开聊14天后会显示收益');
|
||||
};
|
||||
const handleClickHelpPay = () => {
|
||||
Toast.info('会员支付15日后结算收益');
|
||||
};
|
||||
const handleClickHelpInvite = () => {
|
||||
Toast.info('所邀合伙人获得收益后自动获得收益');
|
||||
};
|
||||
return (
|
||||
<div className={PREFIX}>
|
||||
<div className={`${PREFIX}__top`}>
|
||||
<PartnerKanban />
|
||||
</div>
|
||||
<div className={`${PREFIX}__main`}>
|
||||
<Tabs className={`${PREFIX}__tabs`}>
|
||||
<Tabs.TabPane title="推荐主播收益">
|
||||
<Tabs className={`${PREFIX}__tabs`} ellipsis={false}>
|
||||
<Tabs.TabPane
|
||||
title={
|
||||
<>
|
||||
推荐主播收益
|
||||
<Image
|
||||
className={`${PREFIX}__help-icon`}
|
||||
src={require('@/statics/svg/help.svg')}
|
||||
onClick={handleClickHelpChat}
|
||||
/>
|
||||
</>
|
||||
}
|
||||
>
|
||||
<TableTitle />
|
||||
<ProfitList type={ProfitType.CHAT_SHARE} />
|
||||
</Tabs.TabPane>
|
||||
<Tabs.TabPane title="推荐会员权益">
|
||||
<Tabs.TabPane
|
||||
title={
|
||||
<>
|
||||
推荐会员权益
|
||||
<Image
|
||||
className={`${PREFIX}__help-icon`}
|
||||
src={require('@/statics/svg/help.svg')}
|
||||
onClick={handleClickHelpPay}
|
||||
/>
|
||||
</>
|
||||
}
|
||||
>
|
||||
<TableTitle />
|
||||
<ProfitList type={ProfitType.PAYMENT_SHARE} />
|
||||
</Tabs.TabPane>
|
||||
<Tabs.TabPane title="推荐合伙人收益">
|
||||
<Tabs.TabPane
|
||||
title={
|
||||
<>
|
||||
推荐合伙人收益
|
||||
<Image
|
||||
className={`${PREFIX}__help-icon`}
|
||||
src={require('@/statics/svg/help.svg')}
|
||||
onClick={handleClickHelpInvite}
|
||||
/>
|
||||
</>
|
||||
}
|
||||
>
|
||||
<TableTitle />
|
||||
<ProfitList type={ProfitType.INDIRECT_MEMBER_REFERRAL} />
|
||||
</Tabs.TabPane>
|
||||
|
@ -2,53 +2,53 @@ export enum ProfitStatus {
|
||||
/**
|
||||
* 待处理/待计算 (例如,等待上游数据或条件满足)
|
||||
*/
|
||||
PENDING_CALCULATION = 0,
|
||||
PENDING_CALCULATION = 'PENDING_CALCULATION',
|
||||
|
||||
/**
|
||||
* 待直接结算/待直接分账 (例如,T+7 到账)
|
||||
* 这种类型的佣金会计入银行账户,而非平台余额
|
||||
*/
|
||||
DIRECT_SETTLEMENT_PENDING = 1,
|
||||
DIRECT_SETTLEMENT_PENDING = 'DIRECT_SETTLEMENT_PENDING',
|
||||
|
||||
/**
|
||||
* 直接结算已完成/直接分账已完成
|
||||
*/
|
||||
DIRECT_SETTLEMENT_PROCESSING = 2,
|
||||
DIRECT_SETTLEMENT_PROCESSING = 'DIRECT_SETTLEMENT_PROCESSING',
|
||||
|
||||
/**
|
||||
* 间接收益已结算到合伙人余额 (例如,主播推荐奖金进入可提现余额)
|
||||
*/
|
||||
INDIRECT_SETTLED_TO_BALANCE = 3,
|
||||
INDIRECT_SETTLED_TO_BALANCE = 'INDIRECT_SETTLED_TO_BALANCE',
|
||||
|
||||
/**
|
||||
* 佣金已取消 (例如,订单退款,不满足条件等)
|
||||
*/
|
||||
CANCELLED = 4,
|
||||
CANCELLED = 'CANCELLED',
|
||||
|
||||
/**
|
||||
* 佣金处理失败
|
||||
*/
|
||||
FAILED = 5,
|
||||
FAILED = 'FAILED',
|
||||
|
||||
/**
|
||||
* 其他状态
|
||||
*/
|
||||
OTHER = 6,
|
||||
OTHER = 'OTHER',
|
||||
|
||||
/**
|
||||
* 已完成
|
||||
*/
|
||||
FINISHED = 7,
|
||||
FINISHED = 'FINISHED',
|
||||
}
|
||||
|
||||
// 如果需要为每个枚举值添加描述,可以使用一个单独的映射对象
|
||||
export const ProfitStatusDescriptions: { [key in ProfitStatus]: string } = {
|
||||
[ProfitStatus.PENDING_CALCULATION]: '',
|
||||
[ProfitStatus.DIRECT_SETTLEMENT_PENDING]: '待分账',
|
||||
[ProfitStatus.DIRECT_SETTLEMENT_PROCESSING]: '',
|
||||
[ProfitStatus.INDIRECT_SETTLED_TO_BALANCE]: '',
|
||||
[ProfitStatus.CANCELLED]: '',
|
||||
[ProfitStatus.FAILED]: '',
|
||||
[ProfitStatus.OTHER]: '',
|
||||
[ProfitStatus.FINISHED]: '已分账',
|
||||
export const ProfitStatusDescriptions = {
|
||||
PENDING_CALCULATION: '',
|
||||
DIRECT_SETTLEMENT_PENDING: '待分账',
|
||||
DIRECT_SETTLEMENT_PROCESSING: '',
|
||||
INDIRECT_SETTLED_TO_BALANCE: '',
|
||||
CANCELLED: '',
|
||||
FAILED: '',
|
||||
OTHER: '',
|
||||
FINISHED: '已分账',
|
||||
};
|
||||
|
@ -107,14 +107,14 @@ class Http {
|
||||
url: BASE_URL + url,
|
||||
data,
|
||||
method: method,
|
||||
header: { 'content-type': contentType /*, 'user-Id': '588002047871053824' */ },
|
||||
header: { 'content-type': contentType /*'user-Id': '588002047871053824' */ },
|
||||
};
|
||||
return this.request(option);
|
||||
};
|
||||
|
||||
async init() {
|
||||
async init(inviteCode?: string) {
|
||||
if (isTokenExpired()) {
|
||||
await refreshToken();
|
||||
await refreshToken(inviteCode);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import Taro from '@tarojs/taro';
|
||||
|
||||
import { getRoleType } from '@/utils/app';
|
||||
import { getRoleTypeWithDefault } from '@/utils/app';
|
||||
import { isDev } from '@/utils/common';
|
||||
|
||||
import { getToken } from './utils';
|
||||
@ -20,7 +20,7 @@ const tokenInterceptor: Taro.interceptor = (chain: Taro.Chain) => {
|
||||
|
||||
const roleInterceptor: Taro.interceptor = (chain: Taro.Chain) => {
|
||||
const requestParams = chain.requestParams;
|
||||
const roleType = getRoleType();
|
||||
const roleType = getRoleTypeWithDefault();
|
||||
requestParams.header = {
|
||||
...requestParams.header,
|
||||
'role-type': roleType,
|
||||
|
@ -24,10 +24,10 @@ const clearToken = () => {
|
||||
Taro.setStorageSync(TOKEN_EXPIRES_TIME, 0);
|
||||
};
|
||||
|
||||
const requestToken = (): Promise<string> => {
|
||||
const requestToken = (inviteCode?: string): Promise<string> => {
|
||||
return getCode()
|
||||
.then(code => {
|
||||
return http.post<LoginResponse>(API.LOGIN, { data: { code } }).then(data => {
|
||||
return http.post<LoginResponse>(API.LOGIN, { data: { code, inviteCode } }).then(data => {
|
||||
const newToken = data?.token || '';
|
||||
const expires = data?.expires || 0;
|
||||
if (newToken) {
|
||||
@ -47,12 +47,12 @@ const requestToken = (): Promise<string> => {
|
||||
|
||||
export const isTokenExpired = () => (Taro.getStorageSync(TOKEN_EXPIRES_TIME) || 0) < Date.now();
|
||||
|
||||
export const refreshToken = () => {
|
||||
export const refreshToken = (inviteCode?: string) => {
|
||||
if (_fetchTokenPromise) {
|
||||
return _fetchTokenPromise;
|
||||
}
|
||||
clearToken();
|
||||
_fetchTokenPromise = requestToken();
|
||||
_fetchTokenPromise = requestToken(inviteCode);
|
||||
return _fetchTokenPromise;
|
||||
};
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { useShareAppMessage } from '@tarojs/taro';
|
||||
|
||||
import { Button, Tabs } from '@taroify/core';
|
||||
import { useCallback } from 'react';
|
||||
|
||||
@ -6,6 +7,7 @@ import HomePage from '@/components/home-page';
|
||||
import SearchCity from '@/components/search-city';
|
||||
import UserBatchPublish from '@/components/user-batch-publish';
|
||||
import { GROUPS } from '@/constants/group';
|
||||
import useInviteCode from '@/hooks/use-invite-code';
|
||||
import { openCustomerServiceChat } from '@/utils/common';
|
||||
import { getCurrentCityCode } from '@/utils/location';
|
||||
import { getCommonShareMessage } from '@/utils/share';
|
||||
@ -14,6 +16,8 @@ import './index.less';
|
||||
const PREFIX = 'page-biz-service';
|
||||
|
||||
export default function BizService() {
|
||||
const inviteCode = useInviteCode();
|
||||
|
||||
const handleOpenService = useCallback(() => {
|
||||
openCustomerServiceChat('https://work.weixin.qq.com/kfid/kfcd60708731367168d');
|
||||
}, []);
|
||||
@ -23,7 +27,7 @@ export default function BizService() {
|
||||
openCustomerServiceChat(group.serviceUrl);
|
||||
}
|
||||
}, []);
|
||||
useShareAppMessage(() => getCommonShareMessage());
|
||||
useShareAppMessage(() => getCommonShareMessage(true, inviteCode));
|
||||
|
||||
return (
|
||||
<HomePage>
|
||||
|
@ -1,10 +1,10 @@
|
||||
import { RoleType, PageUrl } from '@/constants/app';
|
||||
import { PageUrl, RoleType } from '@/constants/app';
|
||||
import { CollectEventName } from '@/constants/event';
|
||||
import { ANCHOR_TAB_LIST, COMPANY_TAB_LIST } from '@/hooks/use-config';
|
||||
import http from '@/http';
|
||||
import { API } from '@/http/api';
|
||||
import store from '@/store';
|
||||
import { changeRoleType, changeHomePage } from '@/store/actions';
|
||||
import { changeHomePage, changeRoleType } from '@/store/actions';
|
||||
import { selectRoleType } from '@/store/selector';
|
||||
import { sleep } from '@/utils/common';
|
||||
import { collectEvent } from '@/utils/event';
|
||||
@ -18,7 +18,9 @@ const postSwitchRoleType = (appMode: RoleType) => {
|
||||
|
||||
export const getRoleType = () => selectRoleType(store.getState());
|
||||
|
||||
export const isAnchorMode = () => getRoleType() === RoleType.Anchor;
|
||||
export const getRoleTypeWithDefault = () => getRoleType() || RoleType.Anchor;
|
||||
|
||||
export const isAnchorMode = () => getRoleTypeWithDefault() === RoleType.Anchor;
|
||||
|
||||
export const isCompanyMode = () => getRoleType() === RoleType.Company;
|
||||
|
||||
|
@ -18,7 +18,7 @@ import {
|
||||
IChatActionDetail,
|
||||
ChatWatchRequest,
|
||||
} from '@/types/message';
|
||||
import { getRoleType } from '@/utils/app';
|
||||
import { getRoleTypeWithDefault } from '@/utils/app';
|
||||
import { logWithPrefix, oncePromise } from '@/utils/common';
|
||||
import { collectEvent } from '@/utils/event';
|
||||
import { navigateTo } from '@/utils/route';
|
||||
@ -60,12 +60,12 @@ export const requestMessageList = oncePromise(async () => {
|
||||
});
|
||||
|
||||
export const requestChatDetail = (chatId: string) => {
|
||||
const data = { chatId, roleType: getRoleType() };
|
||||
const data = { chatId, roleType: getRoleTypeWithDefault() };
|
||||
return http.post<IChatInfo>(API.MESSAGE_CHAT, { data, contentType: 'application/x-www-form-urlencoded' });
|
||||
};
|
||||
|
||||
export const requestNewChatMessages = (params: GetNewChatMessagesRequest) => {
|
||||
const data = { ...params, roleType: getRoleType() };
|
||||
const data = { ...params, roleType: getRoleTypeWithDefault() };
|
||||
return http.post<IChatMessage[]>(API.MESSAGE_CHAT_NEW, { data });
|
||||
};
|
||||
|
||||
|
@ -77,7 +77,7 @@ export const formatMoney = (cents: number) => {
|
||||
};
|
||||
export function formatTimestamp(timestamp: string): string {
|
||||
// 创建 Date 对象
|
||||
const date = new Date(timestamp);
|
||||
const date = new Date(/^\d+$/.test(timestamp) ? Number(timestamp) : timestamp);
|
||||
|
||||
// 获取年、月、日、时、分、秒
|
||||
const YYYY = date.getFullYear();
|
||||
|
Loading…
Reference in New Issue
Block a user