feat(admin): 新增陪诊员入驻申请与全局角色守卫
- 新增 pages/apply 入驻申请页:填写资料、上传证件、查看审核状态 - 新增 utils/role.js 统一角色解析与管理端页面守卫 - app.js 包装 Page 构造器集中做 onShow 守卫,无身份用户重定向至申请页 - 订单、客户、档案、统计等按角色区分能力:陪诊员不请求档案接口,改用订单快照 - 订单列表支持待取消订单一键同意取消;新增订单价格由服务目录决定只读展示
This commit is contained in:
+22
-11
@@ -1,5 +1,6 @@
|
||||
// pages/order/orderDetail.js
|
||||
const API = require('../../utils/api.js')
|
||||
const role = require('../../utils/role.js')
|
||||
|
||||
const STATUS_MAP = {
|
||||
pending: '待确认',
|
||||
@@ -74,6 +75,8 @@ Page({
|
||||
data: {
|
||||
orderId: '',
|
||||
loaded: false,
|
||||
// 角色:管理员可查看档案与退款操作,陪诊员只看服务必需信息
|
||||
isAdmin: false,
|
||||
// 订单数据
|
||||
order: null,
|
||||
// 格式化后的显示字段
|
||||
@@ -105,9 +108,11 @@ Page({
|
||||
onLoad(options) {
|
||||
const id = options.id || ''
|
||||
this.setData({ orderId: id })
|
||||
if (id) {
|
||||
this.loadOrderDetail(id)
|
||||
}
|
||||
// 先解析角色:详情页按角色决定是否读取档案、是否展示退款操作
|
||||
role.ensureRole().then(r => {
|
||||
this.setData({ isAdmin: r === 'admin' })
|
||||
if (id) this.loadOrderDetail(id)
|
||||
})
|
||||
},
|
||||
|
||||
onPullDownRefresh() {
|
||||
@@ -168,9 +173,11 @@ Page({
|
||||
payChannelText: PAY_CHANNEL_MAP[payment.payChannel || 'offline'] || '',
|
||||
// 线上退款:回调丢失时由管理端主动查退款补写终态;
|
||||
// 人工核销:线下退款、或历史手工标记「线上微信」但无退款单的订单;
|
||||
// 后端在存在处理中的线上退款时会拒绝,避免误把微信退款标成已完成
|
||||
showQueryRefundBtn: payment.status === 'refunding' && payment.method === 'online_wechat',
|
||||
showManualRefundBtn: payment.status === 'refunding',
|
||||
// 后端在存在处理中的线上退款时会拒绝,避免误把微信退款标成已完成。
|
||||
// 退款属管理员能力,陪诊员不展示
|
||||
showQueryRefundBtn: this.data.isAdmin
|
||||
&& payment.status === 'refunding' && payment.method === 'online_wechat',
|
||||
showManualRefundBtn: this.data.isAdmin && payment.status === 'refunding',
|
||||
queryingRefund: false,
|
||||
completingRefund: false,
|
||||
attendantSexText: attendant.sex === 'male' ? '男' : attendant.sex === 'female' ? '女' : '',
|
||||
@@ -197,8 +204,12 @@ Page({
|
||||
wx.makePhoneCall({ phoneNumber: phone })
|
||||
},
|
||||
|
||||
// 点击患者信息,进入健康档案详情
|
||||
// 点击患者信息,进入健康档案详情(仅管理员有档案权限)
|
||||
onProfileTap() {
|
||||
if (!this.data.isAdmin) {
|
||||
wx.showToast({ title: '仅管理员可查看档案', icon: 'none' })
|
||||
return
|
||||
}
|
||||
if (!this.data.healthProfileId) {
|
||||
wx.showToast({ title: '该订单未关联健康档案', icon: 'none' })
|
||||
return
|
||||
@@ -220,7 +231,7 @@ Page({
|
||||
wx.showModal({
|
||||
title: '确认订单',
|
||||
content: '确认接受此订单?',
|
||||
confirmColor: '#1abc9c',
|
||||
confirmColor: '#C26A2E',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
this.updateStatus('confirmed')
|
||||
@@ -234,7 +245,7 @@ Page({
|
||||
wx.showModal({
|
||||
title: '取消订单',
|
||||
content: '确定要取消此订单?',
|
||||
confirmColor: '#ff6b6b',
|
||||
confirmColor: '#C0564A',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
this.updateStatus('cancelled')
|
||||
@@ -248,7 +259,7 @@ Page({
|
||||
wx.showModal({
|
||||
title: '开始服务',
|
||||
content: '确认开始陪诊服务?',
|
||||
confirmColor: '#1abc9c',
|
||||
confirmColor: '#C26A2E',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
this.updateStatus('in_progress')
|
||||
@@ -262,7 +273,7 @@ Page({
|
||||
wx.showModal({
|
||||
title: '完成服务',
|
||||
content: '确认陪诊服务已完成?',
|
||||
confirmColor: '#1abc9c',
|
||||
confirmColor: '#C26A2E',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
this.updateStatus('completed')
|
||||
|
||||
Reference in New Issue
Block a user