- 后端:RlzDispatch/Profit/Promotion/Region 控制器、服务、Mapper、领域模型 - 权限:MethodSecurityConfig + PermissionInterceptor - 管理后台:派单/分润/推广/区域 页面与 API - Android 陪护端:派单/运营/退款 Fragment 及布局 - 小程序:推广员子包、派单/运营/退款/检索子包、自定义 tabBar - 文档:多角色系统方案、角色权限矩阵、用户操作手册等 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
194 lines
6.9 KiB
JavaScript
194 lines
6.9 KiB
JavaScript
// app.js
|
||
const config = require('./utils/config')
|
||
|
||
App({
|
||
onLaunch() {
|
||
const uid = wx.getStorageSync('uid')
|
||
const token = wx.getStorageSync('token')
|
||
const userType = wx.getStorageSync('userType')
|
||
if (uid) {
|
||
this.globalData.uid = uid
|
||
}
|
||
if (token) {
|
||
this.globalData.token = token
|
||
}
|
||
if (userType) {
|
||
this.globalData.userType = userType
|
||
}
|
||
},
|
||
globalData: {
|
||
userInfo: null,
|
||
encryptedData: '',
|
||
iv: '',
|
||
code: '',
|
||
|
||
url: config.baseUrl,
|
||
domain: config.baseUrl,
|
||
domaintwo: config.baseUrl,
|
||
imageBaseUrl: config.imageBaseUrl,
|
||
|
||
phone: '',
|
||
uid: '',
|
||
userType: 'C', // 当前角色: C=患者 B=陪诊师 06=推广员 05=调度 04=客服 03=运营 00=超管
|
||
sessionKey: '',
|
||
version_number: '1.0.0',
|
||
|
||
// 角色 TabBar 配置
|
||
ROLE_TABS: {
|
||
'C': [
|
||
{ text: '首页', icon: '/pages/image/income.png', selIcon: '/pages/image/income_a.png' },
|
||
{ text: '服务', icon: '/pages/image/service.png', selIcon: '/pages/image/service.png' },
|
||
{ text: '订单', icon: '/pages/image/dingdan.png', selIcon: '/pages/image/dingdanl.png' },
|
||
{ text: '我的', icon: '/pages/image/my.png', selIcon: '/pages/image/my_a.png' }
|
||
],
|
||
'B': [
|
||
{ text: '待接单', icon: '/pages/image/income.png', selIcon: '/pages/image/income_a.png' },
|
||
{ text: '进行中', icon: '/pages/image/service.png', selIcon: '/pages/image/service.png' },
|
||
{ text: '已完成', icon: '/pages/image/dingdan.png', selIcon: '/pages/image/dingdanl.png' },
|
||
{ text: '我的', icon: '/pages/image/my.png', selIcon: '/pages/image/my_a.png' }
|
||
],
|
||
'06': [
|
||
{ text: '推广数据', icon: '/pages/image/income.png', selIcon: '/pages/image/income_a.png' },
|
||
{ text: '我的团队', icon: '/pages/image/service.png', selIcon: '/pages/image/service.png' },
|
||
{ text: '佣金', icon: '/pages/image/dingdan.png', selIcon: '/pages/image/dingdanl.png' },
|
||
{ text: '我的', icon: '/pages/image/my.png', selIcon: '/pages/image/my_a.png' }
|
||
],
|
||
'03': [
|
||
{ text: '待处理', icon: '/pages/image/income.png', selIcon: '/pages/image/income_a.png' },
|
||
{ text: '全部订单', icon: '/pages/image/dingdan.png', selIcon: '/pages/image/dingdanl.png' },
|
||
{ text: '收益', icon: '/pages/image/service.png', selIcon: '/pages/image/service.png' },
|
||
{ text: '我的', icon: '/pages/image/my.png', selIcon: '/pages/image/my_a.png' }
|
||
],
|
||
'04': [
|
||
{ text: '待处理', icon: '/pages/image/income.png', selIcon: '/pages/image/income_a.png' },
|
||
{ text: '全部订单', icon: '/pages/image/dingdan.png', selIcon: '/pages/image/dingdanl.png' },
|
||
{ text: '收益', icon: '/pages/image/service.png', selIcon: '/pages/image/service.png' },
|
||
{ text: '我的', icon: '/pages/image/my.png', selIcon: '/pages/image/my_a.png' }
|
||
],
|
||
'05': [
|
||
{ text: '待派单', icon: '/pages/image/income.png', selIcon: '/pages/image/income_a.png' },
|
||
{ text: '全部订单', icon: '/pages/image/dingdan.png', selIcon: '/pages/image/dingdanl.png' },
|
||
{ text: '收益', icon: '/pages/image/service.png', selIcon: '/pages/image/service.png' },
|
||
{ text: '我的', icon: '/pages/image/my.png', selIcon: '/pages/image/my_a.png' }
|
||
]
|
||
},
|
||
|
||
// 角色中文名映射
|
||
ROLE_LABELS: {
|
||
'00': '超级管理员',
|
||
'03': '运营经理',
|
||
'04': '客服专员',
|
||
'05': '调度员',
|
||
'06': '推广员',
|
||
'B': '陪诊师',
|
||
'C': '患者'
|
||
},
|
||
|
||
// 可自助切换的角色对
|
||
ROLE_SWITCHABLE: ['C', '06', 'B'],
|
||
|
||
// 订单状态映射(订单状态:-2:已取消 -1:拒绝接单 0:待接单 1:已接单
|
||
// 2:待服务 3:服务中 4:已完成 5:退款中 6:退款中 7:已退款 8:已结算)
|
||
STATUS_MAP: {
|
||
'-2': '已取消', '-1': '拒绝接单', '0': '待接单',
|
||
'1': '已接单', '2': '服务中', '3': '待支付',
|
||
'4': '已完成', '5': '申请退款', '6': '退款中',
|
||
'7': '已退款', '8': '已结算'
|
||
},
|
||
|
||
// 退款原因列表(全局公用,避免每页重复定义)
|
||
REFUND_REASONS: [
|
||
{ text: '不喜欢/不想要' },
|
||
{ text: '商品信息与描述不符' },
|
||
{ text: '买多/买错/计划有变' },
|
||
{ text: '更换其他项目、购买了其他项目' },
|
||
{ text: '没有时间/个人原因' },
|
||
{ text: '其他原因' }
|
||
],
|
||
},
|
||
console: function (msg) {
|
||
console.log(msg);
|
||
},
|
||
tip: function (params) {
|
||
var that = this;
|
||
var title = params.hasOwnProperty('title') ? params['title'] : '提示您';
|
||
var content = params.hasOwnProperty('content') ? params['content'] : '';
|
||
wx.showModal({
|
||
title: title,
|
||
content: content,
|
||
success: function (res) {
|
||
if (res.confirm) { //点击确定
|
||
if (params.hasOwnProperty('cb_confirm') && typeof (params.cb_confirm) == "function") {
|
||
params.cb_confirm();
|
||
}
|
||
} else { //点击否
|
||
if (params.hasOwnProperty('cb_cancel') && typeof (params.cb_cancel) == "function") {
|
||
params.cb_cancel();
|
||
}
|
||
}
|
||
}
|
||
})
|
||
},
|
||
getRequestHeader: function () {
|
||
return {
|
||
'content-type': 'application/x-www-form-urlencoded',
|
||
'Authorization': 'Bearer ' + this.getCache("token")
|
||
}
|
||
},
|
||
buildUrl: function (path, params) {
|
||
var url = this.globalData.domain + path;
|
||
var _paramUrl = "";
|
||
if (params) {
|
||
_paramUrl = Object.keys(params).map(function (k) {
|
||
return [encodeURIComponent(k), encodeURIComponent(params[k])].join("=");
|
||
}).join("&");
|
||
_paramUrl = "?" + _paramUrl;
|
||
}
|
||
return url + _paramUrl;
|
||
},
|
||
buildUrltwo: function (path, params) {
|
||
var url = this.globalData.domaintwo + path;
|
||
var _paramUrl = "";
|
||
if (params) {
|
||
_paramUrl = Object.keys(params).map(function (k) {
|
||
return [encodeURIComponent(k), encodeURIComponent(params[k])].join("=");
|
||
}).join("&");
|
||
_paramUrl = "?" + _paramUrl;
|
||
}
|
||
return url + _paramUrl;
|
||
},
|
||
// 公共导航栏高度,避免每个页面重复计算
|
||
getNavBarHeight: function () {
|
||
var statusBarHeight = (wx.getWindowInfo && wx.getWindowInfo().statusBarHeight) || wx.getSystemInfoSync().statusBarHeight;
|
||
return {
|
||
statusBarHeight: statusBarHeight,
|
||
height: 46 + statusBarHeight
|
||
};
|
||
},
|
||
|
||
// 修复图片路径:相对路径补全 baseUrl,绝对 URL 或空值原样返回
|
||
fixImageUrl: function (path) {
|
||
if (!path) return '';
|
||
if (path.indexOf('http') === 0) return path;
|
||
return this.globalData.url + path;
|
||
},
|
||
|
||
// 获取订单状态文案
|
||
getStatusLabel: function (status) {
|
||
return this.globalData.STATUS_MAP[String(status)] || '';
|
||
},
|
||
|
||
getCache: function (key) {
|
||
var value = undefined;
|
||
try {
|
||
value = wx.getStorageSync(key);
|
||
} catch (e) {}
|
||
return value;
|
||
},
|
||
setCache: function (key, value) {
|
||
wx.setStorage({
|
||
key: key,
|
||
data: value
|
||
});
|
||
}
|
||
}) |