feat(uniapp_v2): 二开功能迁移与小程序主包优化

- 从 uniapp 迁移 HJF 页面、API、组件及用户/订单相关改动
- queue、assets 使用独立分包以降低主包体积
- 修复首页单根节点与支付结果页 v-if 链
- 关闭 HjfDemoPanel 全局注册;uniNoticeBar 注释 $getAppWebview 避免 __webviewId__ 报错
- 配置域名与 manifest 应用名称;cache/store 防御性处理

Made-with: Cursor
This commit is contained in:
apple
2026-03-26 12:16:01 +08:00
parent c84aeda062
commit 8e17762510
742 changed files with 184117 additions and 0 deletions

View File

@@ -0,0 +1,142 @@
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
import {
SUBSCRIBE_MESSAGE
} from '../config/cache.js';
export function auth() {
let tmplIds = {};
let messageTmplIds = uni.getStorageSync(SUBSCRIBE_MESSAGE);
tmplIds = messageTmplIds ? JSON.parse(messageTmplIds) : {};
return tmplIds;
}
/**
* 支付成功后订阅消息id
* 订阅 确认收货通知 订单支付成功 新订单管理员提醒
*/
export function openPaySubscribe() {
let tmplIds = auth();
return subscribe([
tmplIds.order_pay_success,
tmplIds.order_deliver_success,
tmplIds.order_postage_success,
]);
}
/**
* 订单相关订阅消息
* 送货 发货 取消订单
*/
export function openOrderSubscribe() {
let tmplIds = auth();
return subscribe([
tmplIds.order_take,
tmplIds.integral_accout,
tmplIds.order_brokerage
]);
}
/**
* 提现消息订阅
* 成功 和 失败 消息
*/
export function openExtrctSubscribe() {
let tmplIds = auth();
return subscribe([
tmplIds.user_extract,
tmplIds.revenue_received
]);
}
/**
* 收益消息订阅
* 成功 和 失败 消息
*/
export function openReceivedSubscribe() {
let tmplIds = auth();
return subscribe([
tmplIds.revenue_received
]);
}
/**
* 拼团成功
*/
export function openPinkSubscribe() {
let tmplIds = auth();
return subscribe([
tmplIds.pink_true,
tmplIds.pink_status
]);
}
/**
* 砍价成功
*/
export function openBargainSubscribe() {
let tmplIds = auth();
return subscribe([
tmplIds.bargain_success
]);
}
/**
* 订单退款
*/
export function openOrderRefundSubscribe() {
let tmplIds = auth();
return subscribe([
tmplIds.order_refund
]);
}
/**
* 充值成功
*/
export function openRechargeSubscribe() {
let tmplIds = auth();
return subscribe([
tmplIds.recharge_success
]);
}
/**
* 签到订阅
*/
export function openSignSubscribe() {
let tmplIds = auth();
return subscribe([
tmplIds.sign_remind_time
]);
}
/**
* 调起订阅界面
* array tmplIds 模板id
*/
export function subscribe(subscrip443tionmessagee502call) {
let weChat = wx;
return new Promise((reslove, reject) => {
weChat.requestSubscribeMessage({
tmplIds: subscrip443tionmessagee502call,
success(res) {
return reslove(res);
},
fail(res) {
return reslove(res);
}
})
});
}

View File

@@ -0,0 +1,7 @@
function checkMac(){
if (/(iPhone|iPad|iPod|iOS|macintosh|mac os x)/i.test(navigator.userAgent)) {
return true
}
}
export const wx = checkMac() ? wx : jWeixin;

View File

@@ -0,0 +1,228 @@
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
import { EXPIRE } from '../config/app';
class Cache {
constructor(handler) {
this.cacheSetHandler = uni.setStorageSync;
this.cacheGetHandler = uni.getStorageSync;
this.cacheClearHandler = uni.removeStorageSync;
this.cacheExpire = 'UNI-APP-CRMEB:TAG';
this.clearOverdue();
}
/**
* 获取当前时间戳
*/
time() {
return Math.round(new Date() / 1000);
}
/**
* 字符串转时间戳
* @param {Object} expiresTime
*/
strTotime(expiresTime){
let expires_time = expiresTime.substring(0, 19);
expires_time = expires_time.replace(/-/g, '/');
return Math.round(new Date(expires_time).getTime() / 1000);
}
/**
* 设置过期时间缓存
* @param {Object} key
* @param {Object} expire
*/
setExpireCaheTag(key, expire) {
expire = expire !== undefined ? expire : EXPIRE;
if (typeof expire === 'number') {
let tag = this.cacheGetHandler(this.cacheExpire), newTag = [],newKeys = [];
if (typeof tag === 'object' && tag.length) {
newTag = tag.map(item => {
newKeys.push(item.key);
if (item.key === key) {
item.expire = expire === 0 ? 0 : this.time() + expire;
}
return item;
});
}
if (!newKeys.length || newKeys.indexOf(key) === -1) {
newTag.push({
key: key,
expire: expire === 0 ? 0 : this.time() + expire
});
}
this.cacheSetHandler(this.cacheExpire, newTag);
}
}
/**
* 缓存是否过期,过期自动删除
* @param {Object} key
* @param {Object} $bool true = 删除,false = 不删除
*/
getExpireCahe(key, $bool) {
try {
let tag = this.cacheGetHandler(this.cacheExpire),time = 0,index = false;
if (typeof tag === 'object' && tag.length) {
tag.map((item,i) => {
if(item.key === key){
time = item.expire
index = i
}
});
if (time) {
let newTime = parseInt(time);
if (time && time < this.time() && !Number.isNaN(newTime)) {
if ($bool === undefined || $bool === true) {
this.cacheClearHandler(key);
if(index !== false){
tag.splice(index,1)
this.cacheSetHandler(this.cacheExpire,tag);
}
}
return false;
} else
return true;
} else {
return !!this.cacheGetHandler(key);
}
}
return false;
} catch (e) {
return false;
}
}
/**
* 设置缓存
* @param {Object} key
* @param {Object} data
*/
set(key, data, expire) {
if (data === undefined) {
return true;
}
if (typeof data === 'object')
data = JSON.stringify(data);
try {
this.setExpireCaheTag(key, expire);
return this.cacheSetHandler(key, data);
} catch (e) {
return false;
}
}
/**
* 检测缓存是否存在
* @param {Object} key
*/
has(checkwhethethecacheexists) {
this.clearOverdue();
return this.getExpireCahe(checkwhethethecacheexists);
}
/**
* 获取缓存
* @param {Object} key
* @param {Object} $default
* @param {Object} expire
*/
get(key, $default, expire) {
this.clearOverdue();
try {
let isBe = this.getExpireCahe(key);
let data = this.cacheGetHandler(key);
if (data && isBe) {
if (typeof $default === 'boolean')
return JSON.parse(data);
else
return data;
} else {
if (typeof $default === 'function') {
let value = $default();
this.set(key, value, expire);
return value;
} else {
this.set(key, $default, expire);
return $default;
}
}
} catch (e) {
return null;
}
}
/**
* 删除缓存
* @param {Object} key
*/
clear(key) {
try {
let cahceValue = this.cacheGetHandler(this.cacheExpire),
index = false;
if (cahceValue && typeof cahceValue === 'object' && cahceValue.length) {
cahceValue.map((item, i) => {
if (item.key === key) {
index = i;
}
});
if (index !== false) {
cahceValue.splice(index, 1);
}
this.cacheSetHandler(this.cacheExpire, cahceValue);
}
return this.cacheClearHandler(key);
} catch (e) {
return false;
}
}
/**
* 清除过期缓存
*/
clearOverdue() {
try {
let cahceValue = this.cacheGetHandler(this.cacheExpire),
time = this.time(),
newBeOverdueValue = [],
newTagValue = [];
if (Array.isArray(cahceValue) && cahceValue.length) {
cahceValue.map(item => {
if (item) {
if ((item.expire !== undefined && item.expire > time) || item.expire === 0) {
newTagValue.push(item);
} else {
newBeOverdueValue.push(item.key);
}
}
});
}
//保存没有过期的缓存标签
if (!Array.isArray(cahceValue) || newTagValue.length !== cahceValue.length) {
this.cacheSetHandler(this.cacheExpire, newTagValue);
}
//删除过期缓存
newBeOverdueValue.forEach(k => {
this.cacheClearHandler(k);
})
} catch (e) {
// H5 初始化阶段 uni 存储 API 可能尚未就绪,忽略错误
}
}
}
export default new Cache;

View File

@@ -0,0 +1,107 @@
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
export default [
'em-tlj-1',
'em-tlj-3',
'em-tlj-4',
'em-tlj-5',
'em-tlj-6',
'em-tlj-7',
'em-tlj-8',
'em-tlj-9',
'em-tlj-10',
'em-tlj-11',
'em-tlj-12',
'em-tlj-13',
'em-tlj-14',
'em-tlj-15',
'em-tlj-16',
'em-tlj-17',
'em-tlj-18',
'em-tlj-19',
'em-tlj-20',
'em-tlj-21',
'em-tlj-22',
'em-tlj-23',
'em-tlj-24',
'em-tlj-25',
'em-tlj-26',
'em-tlj-27',
'em-tlj-28',
'em-tlj-29',
'em-tlj-30',
'em-tlj-31',
'em-tlj-32',
'em-tlj-33',
'em-tlj-34',
'em-tlj-35',
'em-tlj-36',
'em-tlj-37',
'em-tlj-38',
'em-tlj-39',
'em-tlj-40',
'em-tlj-41',
'em-tlj-42',
'em-tlj-43',
'em-tlj-44',
'em-tlj-45',
'em-tlj-46',
'em-tlj-47',
'em-tlj-48',
'em-tlj-49',
'em-tlj-50',
'em-tlj-51',
'em-tlj-52',
'em-tlj-53',
'em-tlj-54',
'em-tlj-55',
'em-tlj-56',
'em-tlj-57',
'em-tlj-58',
'em-tlj-59',
'em-tlj-60',
'em-tlj-61',
'em-tlj-62',
'em-tlj-63',
'em-tlj-64',
'em-tlj-65',
'em-tlj-66',
'em-tlj-67',
'em-tlj-68',
'em-tlj-69',
'em-tlj-70',
'em-tlj-71',
'em-tlj-72',
'em-tlj-73',
'em-tlj-74',
'em-tlj-75',
'em-tlj-76',
'em-tlj-77',
'em-tlj-78',
'em-tlj-79',
'em-tlj-80',
'em-tlj-81',
'em-tlj-82',
'em-tlj-83',
'em-tlj-84',
'em-tlj-85',
'em-tlj-86',
'em-tlj-87',
'em-tlj-88',
'em-tlj-89',
'em-tlj-90',
'em-tlj-91',
'em-tlj-92',
'em-tlj-93',
'em-tlj-94',
'em-tlj-95',
'em-tlj-96',
];

View File

@@ -0,0 +1,636 @@
/**
* 范氏国香商城 - UniApp Mock 数据集中管理
* Phase 1 前端开发使用Phase 4 集成后可移除
*/
// ========== 场景切换系统 ==========
/**
* 当前演示场景
* 'A' - 新用户(首次体验)
* 'B' - 活跃用户(等待退款中)- 默认
* 'C' - VIP用户退款刚触发
*/
let MOCK_SCENARIO = 'B';
/**
* 切换场景并触发页面刷新
* @param {string} scenario - 'A' | 'B' | 'C'
*/
export function setMockScenario(scenario) {
if (['A', 'B', 'C'].includes(scenario)) {
MOCK_SCENARIO = scenario;
console.log(`[HJF Mock] 已切换到场景 ${scenario}`);
// 触发全局事件,通知页面刷新
uni.$emit('hjf-scenario-changed', scenario);
return true;
}
return false;
}
/**
* 获取当前场景
*/
export function getCurrentScenario() {
return MOCK_SCENARIO;
}
// ========== 佣金进度模块(原公排模块) ==========
export const MOCK_BROKERAGE_PROGRESS = {
cycle_total: 3,
cycle_current: 2,
cycle_rates: [20, 30, 50],
total_brokerage: '7200.00',
total_completed: 8
};
// 兼容旧名称
export const MOCK_QUEUE_STATUS = MOCK_BROKERAGE_PROGRESS;
export const MOCK_QUEUE_HISTORY = { list: [], count: 0, page: 1, limit: 15 };
// ========== 资产模块 ==========
export const MOCK_ASSETS_OVERVIEW = {
brokerage_price: '7200.00',
now_money: '7200.00',
frozen_points: 15000,
available_points: 3200,
today_release: 6,
agent_level: 2,
agent_level_name: '云店'
};
export const MOCK_POINTS_DETAIL = {
list: [
{
id: 1,
title: '直推奖励 - 用户张三购买报单商品',
type: 'reward_direct',
points: 800,
pm: 1,
status: 'frozen',
add_time: '2026-03-10 14:30',
order_id: 'HJF202603100005'
},
{
id: 2,
title: '每日释放 - 待释放积分自动解冻',
type: 'release',
points: 6,
pm: 1,
status: 'released',
add_time: '2026-03-10 00:00',
release_date: '2026-03-10'
},
{
id: 3,
title: '积分消费 - 购买普通商品',
type: 'consume',
points: 200,
pm: 0,
status: 'released',
add_time: '2026-03-09 16:22',
order_id: 'HJF202603090012'
},
{
id: 4,
title: '伞下奖励 - 用户李四购买报单商品',
type: 'reward_umbrella',
points: 300,
pm: 1,
status: 'frozen',
add_time: '2026-03-09 10:15',
order_id: 'HJF202603090003'
},
{
id: 5,
title: '每日释放 - 待释放积分自动解冻',
type: 'release',
points: 6,
pm: 1,
status: 'released',
add_time: '2026-03-09 00:00',
release_date: '2026-03-09'
}
],
count: 45,
page: 1,
limit: 15
};
export const MOCK_CASH_DETAIL = {
list: [
{
id: 1,
title: '推荐佣金 - 订单FSGX202603050001',
amount: '1800.00',
pm: 1,
add_time: '2026-03-07 12:00',
order_id: 'FSGX202603050001'
},
{
id: 2,
title: '提现 - 微信零钱',
amount: '930.00',
pm: 0,
add_time: '2026-03-06 15:30',
remark: '手续费¥70.00'
},
{
id: 3,
title: '购物消费',
amount: '299.00',
pm: 0,
add_time: '2026-03-05 09:20',
order_id: 'FSGX202603050010'
}
],
count: 12,
page: 1,
limit: 15
};
export const MOCK_WITHDRAW_INFO = {
brokerage_price: '7200.00',
now_money: '7200.00',
min_extract: 100,
fee_rate: 7,
extract_bank: ['微信零钱', '支付宝', '银行卡'],
bank_list: [
{ bank_name: '中国工商银行', bank_code: '1234****5678' }
]
};
// ========== 会员模块 ==========
export const MOCK_MEMBER_INFO = {
member_level: 2,
member_level_name: '云店',
direct_count: 8,
umbrella_count: 35,
umbrella_orders: 42,
next_level_name: '服务商',
next_level_require: 100,
progress_percent: 42
};
export const MOCK_TEAM_DATA = {
direct_count: 8,
umbrella_count: 35,
umbrella_orders: 42,
members: [
{
uid: 10087,
nickname: '张三',
avatar: '/static/images/default_avatar.png',
member_level: 1,
member_level_name: '创客',
join_time: '2026-02-15',
direct_orders: 5,
is_direct: true
},
{
uid: 10088,
nickname: '李四',
avatar: '/static/images/default_avatar.png',
member_level: 0,
member_level_name: '普通会员',
join_time: '2026-03-01',
direct_orders: 1,
is_direct: false,
parent_nickname: '张三'
},
{
uid: 10089,
nickname: '王五',
avatar: '/static/images/default_avatar.png',
member_level: 2,
member_level_name: '云店',
join_time: '2026-01-20',
direct_orders: 12,
is_direct: true
}
],
page: 1,
count: 35
};
export const MOCK_TEAM_INCOME = {
list: [
{
id: 1,
title: '直推奖励',
from_uid: 10087,
from_nickname: '张三',
order_id: 'HJF202603100005',
points: 800,
type: 'direct',
add_time: '2026-03-10 14:30'
},
{
id: 2,
title: '伞下奖励(级差)',
from_uid: 10088,
from_nickname: '李四',
order_id: 'HJF202603090003',
points: 300,
type: 'umbrella',
add_time: '2026-03-09 10:15'
},
{
id: 3,
title: '直推奖励',
from_uid: 10089,
from_nickname: '王五',
order_id: 'HJF202603080010',
points: 800,
type: 'direct',
add_time: '2026-03-08 16:45'
}
],
count: 22,
page: 1,
limit: 15
};
// ========== 引导模块 ==========
export const MOCK_GUIDE_DATA = {
slides: [
{
title: '欢迎来到范氏国香商城',
desc: '优质国香,品质生活',
image: '/static/images/guide/slide1.png'
},
{
title: '推荐佣金机制',
desc: '购买报单商品,推荐好友购买可获得推荐佣金返现',
image: '/static/images/guide/slide2.png'
},
{
title: '会员积分体系',
desc: '获得佣金同步获得待释放积分,积分每日自动释放',
image: '/static/images/guide/slide3.png'
}
]
};
// ========== 场景数据集合 ==========
/**
* 场景 A - 新用户(首次体验)
*/
const SCENARIO_A_DATA = {
queueStatus: {
cycle_total: 3, cycle_current: 0, cycle_rates: [20, 30, 50],
total_brokerage: '0.00', total_completed: 0
},
queueHistory: { list: [], count: 0, page: 1, limit: 15 },
assetsOverview: {
brokerage_price: '0.00',
now_money: '0.00',
frozen_points: 0,
available_points: 0,
today_release: 0,
agent_level: 0,
agent_level_name: '普通会员'
},
pointsDetail: {
list: [],
count: 0,
page: 1,
limit: 15
},
cashDetail: {
list: [],
count: 0,
page: 1,
limit: 15
},
withdrawInfo: {
brokerage_price: '0.00',
now_money: '0.00',
min_extract: 100,
fee_rate: 7,
extract_bank: ['微信零钱', '支付宝', '银行卡'],
bank_list: []
},
memberInfo: {
agent_level: 0,
agent_level_name: '普通会员',
direct_count: 0,
umbrella_count: 0,
umbrella_orders: 0,
next_level_name: '创客',
next_level_require: 3,
progress_percent: 0
},
teamData: {
direct_count: 0,
umbrella_count: 0,
umbrella_orders: 0,
members: [],
page: 1,
count: 0
},
teamIncome: {
list: [],
count: 0,
page: 1,
limit: 15
}
};
/**
* 场景 B - 活跃用户(佣金进行中)- 使用原有数据
*/
const SCENARIO_B_DATA = {
queueStatus: MOCK_BROKERAGE_PROGRESS,
queueHistory: MOCK_QUEUE_HISTORY,
assetsOverview: MOCK_ASSETS_OVERVIEW,
pointsDetail: MOCK_POINTS_DETAIL,
cashDetail: MOCK_CASH_DETAIL,
withdrawInfo: MOCK_WITHDRAW_INFO,
memberInfo: MOCK_MEMBER_INFO,
teamData: MOCK_TEAM_DATA,
teamIncome: MOCK_TEAM_INCOME
};
/**
* 场景 C - VIP 用户(周期佣金丰收)
*/
const SCENARIO_C_DATA = {
queueStatus: {
cycle_total: 3,
cycle_current: 1,
cycle_rates: [20, 30, 50],
total_brokerage: '25200.00',
total_completed: 25
},
queueHistory: { list: [], count: 0, page: 1, limit: 15 },
assetsOverview: {
brokerage_price: '25200.00',
now_money: '25200.00',
frozen_points: 38500,
available_points: 12600,
today_release: 15,
agent_level: 3,
agent_level_name: '服务商'
},
pointsDetail: {
list: [
{
id: 50,
title: '直推奖励 - 用户刘五购买报单商品',
type: 'reward_direct',
points: 1000,
pm: 1,
status: 'frozen',
add_time: '2026-03-11 10:20',
order_id: 'HJF202603110025'
},
{
id: 49,
title: '伞下奖励 - 用户赵六购买报单商品',
type: 'reward_umbrella',
points: 200,
pm: 1,
status: 'frozen',
add_time: '2026-03-11 08:15',
order_id: 'HJF202603110018'
},
{
id: 48,
title: '每日释放 - 待释放积分自动解冻',
type: 'release',
points: 15,
pm: 1,
status: 'released',
add_time: '2026-03-11 00:00',
release_date: '2026-03-11'
},
{
id: 47,
title: '直推奖励 - 用户孙七购买报单商品',
type: 'reward_direct',
points: 1000,
pm: 1,
status: 'frozen',
add_time: '2026-03-10 16:30',
order_id: 'HJF202603100045'
}
],
count: 156,
page: 1,
limit: 15
},
cashDetail: {
list: [
{
id: 15,
title: '推荐佣金 - 订单FSGX202603110001',
amount: '1800.00',
pm: 1,
add_time: '2026-03-11 10:00',
order_id: 'FSGX202603110001'
},
{
id: 14,
title: '推荐佣金 - 订单FSGX202603080008',
amount: '1080.00',
pm: 1,
add_time: '2026-03-08 14:00',
order_id: 'FSGX202603080008'
},
{
id: 13,
title: '提现 - 微信零钱',
amount: '9300.00',
pm: 0,
add_time: '2026-03-07 15:30',
remark: '手续费¥700.00'
},
{
id: 12,
title: '推荐佣金 - 订单FSGX202603050007',
amount: '720.00',
pm: 1,
add_time: '2026-03-05 12:00',
order_id: 'FSGX202603050007'
}
],
count: 28,
page: 1,
limit: 15
},
withdrawInfo: {
brokerage_price: '25200.00',
now_money: '25200.00',
min_extract: 100,
fee_rate: 7,
extract_bank: ['微信零钱', '支付宝', '银行卡'],
bank_list: [
{ bank_name: '中国工商银行', bank_code: '1234****5678' }
]
},
memberInfo: {
agent_level: 3,
agent_level_name: '服务商',
direct_count: 15,
umbrella_count: 80,
umbrella_orders: 125,
next_level_name: '分公司',
next_level_require: 1000,
progress_percent: 12.5
},
teamData: {
direct_count: 15,
umbrella_count: 80,
umbrella_orders: 125,
members: [
{
uid: 10091,
nickname: '刘五',
avatar: '/static/images/default_avatar.png',
member_level: 2,
member_level_name: '云店',
join_time: '2026-02-01',
direct_orders: 35,
is_direct: true
},
{
uid: 10092,
nickname: '赵六',
avatar: '/static/images/default_avatar.png',
member_level: 2,
member_level_name: '云店',
join_time: '2026-02-10',
direct_orders: 28,
is_direct: true
},
{
uid: 10093,
nickname: '孙七',
avatar: '/static/images/default_avatar.png',
member_level: 1,
member_level_name: '创客',
join_time: '2026-02-20',
direct_orders: 12,
is_direct: true
},
{
uid: 10094,
nickname: '周八',
avatar: '/static/images/default_avatar.png',
member_level: 0,
member_level_name: '普通会员',
join_time: '2026-03-05',
direct_orders: 2,
is_direct: false,
parent_nickname: '刘五'
}
],
page: 1,
count: 80
},
teamIncome: {
list: [
{
id: 50,
title: '直推奖励',
from_uid: 10091,
from_nickname: '刘五',
order_id: 'HJF202603110025',
points: 1000,
type: 'direct',
add_time: '2026-03-11 10:20'
},
{
id: 49,
title: '伞下奖励(级差)',
from_uid: 10094,
from_nickname: '周八',
order_id: 'HJF202603110018',
points: 200,
type: 'umbrella',
add_time: '2026-03-11 08:15'
},
{
id: 48,
title: '直推奖励',
from_uid: 10092,
from_nickname: '赵六',
order_id: 'HJF202603100045',
points: 1000,
type: 'direct',
add_time: '2026-03-10 16:30'
},
{
id: 47,
title: '伞下奖励(级差)',
from_uid: 10095,
from_nickname: '吴九',
order_id: 'HJF202603100032',
points: 200,
type: 'umbrella',
add_time: '2026-03-10 11:45'
}
],
count: 85,
page: 1,
limit: 15
}
};
/**
* 场景数据映射
*/
const MOCK_SCENARIO_DATA = {
A: SCENARIO_A_DATA,
B: SCENARIO_B_DATA,
C: SCENARIO_C_DATA
};
/**
* 场景感知的 Mock 数据获取函数
*/
export function getMockBrokerageProgress() {
return JSON.parse(JSON.stringify(MOCK_SCENARIO_DATA[MOCK_SCENARIO].queueStatus));
}
// 兼容旧名称
export const getMockQueueStatus = getMockBrokerageProgress;
export function getMockQueueHistory() {
return JSON.parse(JSON.stringify(MOCK_SCENARIO_DATA[MOCK_SCENARIO].queueHistory));
}
export function getMockAssetsOverview() {
return JSON.parse(JSON.stringify(MOCK_SCENARIO_DATA[MOCK_SCENARIO].assetsOverview));
}
export function getMockPointsDetail() {
return JSON.parse(JSON.stringify(MOCK_SCENARIO_DATA[MOCK_SCENARIO].pointsDetail));
}
export function getMockCashDetail() {
return JSON.parse(JSON.stringify(MOCK_SCENARIO_DATA[MOCK_SCENARIO].cashDetail));
}
export function getMockWithdrawInfo() {
return JSON.parse(JSON.stringify(MOCK_SCENARIO_DATA[MOCK_SCENARIO].withdrawInfo));
}
export function getMockMemberInfo() {
return JSON.parse(JSON.stringify(MOCK_SCENARIO_DATA[MOCK_SCENARIO].memberInfo));
}
export function getMockTeamData() {
return JSON.parse(JSON.stringify(MOCK_SCENARIO_DATA[MOCK_SCENARIO].teamData));
}
export function getMockTeamIncome() {
return JSON.parse(JSON.stringify(MOCK_SCENARIO_DATA[MOCK_SCENARIO].teamIncome));
}

View File

@@ -0,0 +1,92 @@
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
import { spread } from "@/api/user";
import Cache from "@/utils/cache";
import store from '@/store';
/**
* 绑定用户授权
* @param {Object} puid
*/
export function silenceBindingSpread(app) {
//#ifdef H5
let puid = Cache.get('spread'),
code = 0;
//#endif
//#ifdef MP || APP-PLUS
let puid = app.spid,
code = app.code;
//#endif
puid = parseInt(puid);
if (Number.isNaN(puid)) {
puid = 0;
}
if ((code || puid) && store.state.app.token) {
spread({
puid,
code
}).then(res => {
//#ifdef H5
Cache.clear('spread');
//#endif
//#ifdef MP || APP-PLUS
app.spid = 0;
app.code = 0;
//#endif
}).catch(res => {});
}
}
export function isWeixin() {
return navigator.userAgent.toLowerCase().indexOf("micromessenger") !== -1;
}
export function parseQuery() {
const res = {};
const query = (location.href.split("?")[1] || "")
.trim()
.replace(/^(\?|#|&)/, "");
if (!query) {
return res;
}
query.split("&").forEach(param => {
const parts = param.replace(/\+/g, " ").split("=");
const key = decodeURIComponent(parts.shift());
const val = parts.length > 0 ? decodeURIComponent(parts.join("=")) : null;
if (res[key] === undefined) {
res[key] = val;
} else if (Array.isArray(res[key])) {
res[key].push(val);
} else {
res[key] = [res[key], val];
}
});
return res;
}
// #ifdef H5
const VUE_APP_WS_URL = process.env.VUE_APP_WS_URL || `ws://${location.hostname}`;
export {VUE_APP_WS_URL}
const VUE_APP_API_URL = process.env.VUE_APP_API_URL || `${location.protocol}//${location.hostname}`;
export {VUE_APP_API_URL}
// #endif
export default parseQuery;

View File

@@ -0,0 +1,256 @@
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
/// null = 未请求1 = 已允许0 = 拒绝|受限, 2 = 系统未开启
var isIOS
function album() {
var result = 0;
var PHPhotoLibrary = plus.ios.import("PHPhotoLibrary");
var authStatus = PHPhotoLibrary.authorizationStatus();
if (authStatus === 0) {
result = null;
} else if (authStatus == 3) {
result = 1;
} else {
result = 0;
}
plus.ios.deleteObject(PHPhotoLibrary);
return result;
}
function camera() {
var result = 0;
var AVCaptureDevice = plus.ios.import("AVCaptureDevice");
var authStatus = AVCaptureDevice.authorizationStatusForMediaType('vide');
if (authStatus === 0) {
result = null;
} else if (authStatus == 3) {
result = 1;
} else {
result = 0;
}
plus.ios.deleteObject(AVCaptureDevice);
return result;
}
function location() {
var result = 0;
var cllocationManger = plus.ios.import("CLLocationManager");
var enable = cllocationManger.locationServicesEnabled();
var status = cllocationManger.authorizationStatus();
if (!enable) {
result = 2;
} else if (status === 0) {
result = null;
} else if (status === 3 || status === 4) {
result = 1;
} else {
result = 0;
}
plus.ios.deleteObject(cllocationManger);
return result;
}
function push() {
var result = 0;
var UIApplication = plus.ios.import("UIApplication");
var app = UIApplication.sharedApplication();
var enabledTypes = 0;
if (app.currentUserNotificationSettings) {
var settings = app.currentUserNotificationSettings();
enabledTypes = settings.plusGetAttribute("types");
if (enabledTypes == 0) {
result = 0;
console.log("推送权限没有开启");
} else {
result = 1;
console.log("已经开启推送功能!")
}
plus.ios.deleteObject(settings);
} else {
enabledTypes = app.enabledRemoteNotificationTypes();
if (enabledTypes == 0) {
result = 3;
console.log("推送权限没有开启!");
} else {
result = 4;
console.log("已经开启推送功能!")
}
}
plus.ios.deleteObject(app);
plus.ios.deleteObject(UIApplication);
return result;
}
function contact() {
var result = 0;
var CNContactStore = plus.ios.import("CNContactStore");
var cnAuthStatus = CNContactStore.authorizationStatusForEntityType(0);
if (cnAuthStatus === 0) {
result = null;
} else if (cnAuthStatus == 3) {
result = 1;
} else {
result = 0;
}
plus.ios.deleteObject(CNContactStore);
return result;
}
function record() {
var result = null;
var avaudiosession = plus.ios.import("AVAudioSession");
var avaudio = avaudiosession.sharedInstance();
var status = avaudio.recordPermission();
if (status === 1970168948) {
result = null;
} else if (status === 1735552628) {
result = 1;
} else {
result = 0;
}
plus.ios.deleteObject(avaudiosession);
return result;
}
function calendar() {
var result = null;
var EKEventStore = plus.ios.import("EKEventStore");
var ekAuthStatus = EKEventStore.authorizationStatusForEntityType(0);
if (ekAuthStatus == 3) {
result = 1;
console.log("日历权限已经开启");
} else {
console.log("日历权限没有开启");
}
plus.ios.deleteObject(EKEventStore);
return result;
}
function memo() {
var result = null;
var EKEventStore = plus.ios.import("EKEventStore");
var ekAuthStatus = EKEventStore.authorizationStatusForEntityType(1);
if (ekAuthStatus == 3) {
result = 1;
console.log("备忘录权限已经开启");
} else {
console.log("备忘录权限没有开启");
}
plus.ios.deleteObject(EKEventStore);
return result;
}
function requestIOS(permissionID) {
return new Promise((resolve, reject) => {
switch (permissionID) {
case "push":
resolve(push());
break;
case "location":
resolve(location());
break;
case "record":
resolve(record());
break;
case "camera":
resolve(camera());
break;
case "album":
resolve(album());
break;
case "contact":
resolve(contact());
break;
case "calendar":
resolve(calendar());
break;
case "memo":
resolve(memo());
break;
default:
resolve(0);
break;
}
});
}
function requestAndroid(permissionID) {
return new Promise((resolve, reject) => {
plus.android.requestPermissions(
[permissionID],
function(resultObj) {
var result = 0;
for (var i = 0; i < resultObj.granted.length; i++) {
var grantedPermission = resultObj.granted[i];
console.log('已获取的权限:' + grantedPermission);
result = 1
}
for (var i = 0; i < resultObj.deniedPresent.length; i++) {
var deniedPresentPermission = resultObj.deniedPresent[i];
console.log('拒绝本次申请的权限:' + deniedPresentPermission);
result = 0
}
for (var i = 0; i < resultObj.deniedAlways.length; i++) {
var deniedAlwaysPermission = resultObj.deniedAlways[i];
console.log('永久拒绝申请的权限:' + deniedAlwaysPermission);
result = -1
}
resolve(result);
},
function(error) {
console.log('result error: ' + error.message)
resolve({
code: error.code,
message: error.message
});
}
);
});
}
function gotoAppPermissionSetting() {
if (permission.isIOS) {
var UIApplication = plus.ios.import("UIApplication");
var application2 = UIApplication.sharedApplication();
var NSURL2 = plus.ios.import("NSURL");
var setting2 = NSURL2.URLWithString("app-settings:");
application2.openURL(setting2);
plus.ios.deleteObject(setting2);
plus.ios.deleteObject(NSURL2);
plus.ios.deleteObject(application2);
} else {
var Intent = plus.android.importClass("android.content.Intent");
var Settings = plus.android.importClass("android.provider.Settings");
var Uri = plus.android.importClass("android.net.Uri");
var mainActivity = plus.android.runtimeMainActivity();
var intent = new Intent();
intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
var uri = Uri.fromParts("package", mainActivity.getPackageName(), null);
intent.setData(uri);
mainActivity.startActivity(intent);
}
}
const permission = {
get isIOS(){
return typeof isIOS === 'boolean' ? isIOS : (isIOS = uni.getSystemInfoSync().platform === 'ios')
},
requestIOS: requestIOS,
requestAndroid: requestAndroid,
gotoAppSetting: gotoAppPermissionSetting
}
module.exports = permission

View File

@@ -0,0 +1,50 @@
let propertyList = [{
label: "余额",
value: 0,
k: "now_money",
url: '/pages/users/user_money/index'
},
{
label: "优惠券",
value: 1,
k: "couponCount",
url: '/pages/users/user_coupon/index'
},
{
label: "积分",
value: 2,
k: "integral",
url: '/pages/users/user_integral/index'
},
{
label: "收藏",
value: 3,
k: "collectProductCount",
url: '/pages/users/user_goods_collection/index'
},
{
label: "浏览记录",
value: 5,
k: "visit_num",
url: '/pages/users/visit_list/index'
},
{
label: "推广佣金",
value: 6,
k: "brokerage_price",
url: '/pages/users/user_spread_user/index'
},
{
label: "推广人",
value: 7,
k: "spread_user_count",
url: '/pages/users/user_spread_user/index'
},
{
label: "推广订单",
value: 8,
k: "spread_order_count",
url: '/pages/users/user_spread_user/index'
},
];
export default propertyList;

View File

@@ -0,0 +1,142 @@
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
import {
HTTP_REQUEST_URL,
HEADER,
TOKENNAME
} from '@/config/app';
import {
toLogin,
checkLogin
} from '../libs/login';
import store from '../store';
function toLoginMp(){
uni.showToast({
title: '请登录',
icon: 'none',
duration: 1000
});
}
function base64ToUint8Array(base64String) {
let padding = '='.repeat((4 - base64String.length % 4) % 4);
let base64 = (base64String + padding)
.replace(/\-/g, '+')
.replace(/_/g, '/');
let rawData = atob(base64);
let outputArray = new Uint8Array(rawData.length);
for (var i = 0; i < rawData.length; ++i) {
outputArray[i] = rawData.charCodeAt(i);
}
return outputArray;
}
/**
* 发送请求
*/
function baseRequest(url, method, data, {
noAuth = false,
noVerify = false
}) {
let Url = HTTP_REQUEST_URL,
header = HEADER;
if (!noAuth) {
//登录过期自动登录
if (!store.state.app.token && !checkLogin()) {
toLogin();
return Promise.reject({
msg: '未登录'
});
}
}
if (store.state.app.token) header[TOKENNAME] = 'Bearer ' + store.state.app.token;
return new Promise((reslove, reject) => {
uni.request({
url: Url + '/api/' + url,
method: method || 'GET',
header: header,
data: data || {},
success: (res) => {
if (res.data.data && res.data.gzde === 1) {
try{
res.data.data = JSON.parse(decompress(res.data.data));
}catch(e){
res.data.data = decompress(res.data.data);
}
}
if (noVerify)
reslove(res.data, res);
else if (res.data.status == 200)
reslove(res.data, res);
else if ([410000, 410001, 410002].indexOf(res.data.status) !== -1) {
// #ifndef MP
toLogin();
// #endif
// #ifdef MP
toLoginMp();
// #endif
reject(res.data);
} else if (res.data.status == 410010) {
uni.showModal({
title: '提示',
content: res.data.msg,
showCancel: false,
confirmText: '我知道了',
success() {
uni.switchTab({
url: '/pages/index/index'
})
}
});
} else if(res.data.status == 410020){
// reject(res.data.msg);
uni.showModal({
title: '提示',
content: res.data.msg,
showCancel: false,
confirmText: '我知道了'
});
uni.setStorageSync('authIng', true)
} else if(res.data.status == 403){
reject(res.data);
} else
reject(res.data.msg || '系统错误');
},
fail: (msg) => {
let data = {
mag: '请求失败',
status: 1 //1没网
}
// #ifdef APP-PLUS
reject(data);
// #endif
// #ifndef APP-PLUS
reject('请求失败');
// #endif
}
})
});
}
const request = {};
['options', 'get', 'post', 'put', 'head', 'delete', 'trace', 'connect'].forEach((method) => {
request[method] = (api, data, opt) => baseRequest(api, method, data, opt || {})
});
export default request;

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,77 @@
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
/**
* 验证小数点后两位及多个小数
* money 金额
*/
export function isMoney(money) {
var reg = /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/
if (reg.test(money)) {
return true
} else {
return false
}
}
/**
* 验证手机号码
* money 金额
*/
export function checkPhone(c2543fff3bfa6f144c2f06a7de6cd10c0b650cae) {
var reg = /^1(3|4|5|6|7|8|9)\d{9}$/
if (reg.test(c2543fff3bfa6f144c2f06a7de6cd10c0b650cae)) {
return true
} else {
return false
}
}
/**
* 函数防抖 (只执行最后一次点击)
* @param fn
* @param delay
* @returns {Function}
* @constructor
*/
export const Debounce = (fn, t) => {
const delay = t || 500
let timer
return function() {
const args = arguments
if (timer) {
clearTimeout(timer)
}
timer = setTimeout(() => {
timer = null
fn.apply(this, args)
}, delay)
}
}
// 节流函数
export function throttle(fn, delay) {
var lastArgs;
var timer;
var delay = delay || 200;
return function(...args) {
lastArgs = args;
if(!timer){
timer = setTimeout(()=>{
timer = null;
fn.apply(this, lastArgs);
}, delay);
}
}
}