feat(admin): 新增陪诊员入驻申请与全局角色守卫
- 新增 pages/apply 入驻申请页:填写资料、上传证件、查看审核状态 - 新增 utils/role.js 统一角色解析与管理端页面守卫 - app.js 包装 Page 构造器集中做 onShow 守卫,无身份用户重定向至申请页 - 订单、客户、档案、统计等按角色区分能力:陪诊员不请求档案接口,改用订单快照 - 订单列表支持待取消订单一键同意取消;新增订单价格由服务目录决定只读展示
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
// pages/healthprofile/profileInfo.js
|
||||
const API = require('../../utils/api.js')
|
||||
const store = require('../../utils/store.js')
|
||||
const role = require('../../utils/role.js')
|
||||
|
||||
const SEX_MAP = [
|
||||
{ label: '男', value: 'male' },
|
||||
@@ -41,20 +42,25 @@ Page({
|
||||
},
|
||||
|
||||
onLoad(options) {
|
||||
const now = new Date()
|
||||
const today = `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, '0')}-${String(now.getDate()).padStart(2, '0')}`
|
||||
this.setData({ today })
|
||||
if (options && options.id) {
|
||||
this.setData({ isEdit: true, profileId: options.id })
|
||||
wx.setNavigationBarTitle({ title: '档案详情' })
|
||||
this.loadProfile(options.id)
|
||||
} else {
|
||||
wx.setNavigationBarTitle({ title: '新建档案' })
|
||||
}
|
||||
// 档案读写仅管理员可用
|
||||
role.guardAdminPage().then(ok => {
|
||||
if (!ok) return
|
||||
const now = new Date()
|
||||
const today = `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, '0')}-${String(now.getDate()).padStart(2, '0')}`
|
||||
this.setData({ today })
|
||||
if (options && options.id) {
|
||||
this.setData({ isEdit: true, profileId: options.id })
|
||||
wx.setNavigationBarTitle({ title: '档案详情' })
|
||||
this.loadProfile(options.id)
|
||||
} else {
|
||||
wx.setNavigationBarTitle({ title: '新建档案' })
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
onShow() {
|
||||
// 从订单页返回后刷新关联订单列表
|
||||
if (role.getRoleSync() !== 'admin') return
|
||||
if (this.data.isEdit && this.data.profileId) {
|
||||
this.loadProfileOrders(this.data.profileId)
|
||||
}
|
||||
@@ -248,7 +254,7 @@ Page({
|
||||
wx.showModal({
|
||||
title: '删除确认',
|
||||
content: '确定要删除该健康档案吗?删除后不可恢复。',
|
||||
confirmColor: '#ff4d4f',
|
||||
confirmColor: '#C0564A',
|
||||
success: res => {
|
||||
if (!res.confirm) return
|
||||
API.healthProfile.deleteProfile(profileId)
|
||||
|
||||
Reference in New Issue
Block a user