feat(apply): 入驻只收基本信息并新增启动页、材料后补与改服务城市
入驻表单移除身份证与证件材料(服务城市单选下拉,默认北京),只填姓名/手机/性别/城市/简介即可提交;新增 pages/launch 启动页先解析身份再跳转,无身份直接进申请页不再闪现首页;新增 pages/materials 证件材料补传页;个人资料页支持在职陪诊师修改服务城市;appId 更名为 wxapp_companion。
This commit is contained in:
+66
-1
@@ -1,5 +1,7 @@
|
||||
// pages/me/index.js
|
||||
const API = require('../../utils/api.js')
|
||||
const role = require('../../utils/role.js')
|
||||
const { CITY_OPTIONS, CITY_LABELS, cityIndex, cityLabel } = require('../../utils/city.js')
|
||||
|
||||
// 性别映射
|
||||
const SEX_MAP = {
|
||||
@@ -10,7 +12,11 @@ const SEX_MAP = {
|
||||
Page({
|
||||
data: {
|
||||
user: {},
|
||||
identityText: ''
|
||||
identityText: '',
|
||||
isAttendant: false,
|
||||
serviceAreaLabels: CITY_LABELS,
|
||||
serviceAreaIndex: 0,
|
||||
serviceAreaText: ''
|
||||
},
|
||||
|
||||
onShow() {
|
||||
@@ -26,13 +32,72 @@ Page({
|
||||
.ensureRoleSafe()
|
||||
.then((detail) => {
|
||||
const attendant = detail.attendant || null
|
||||
const isAttendant = detail.role === 'attendant'
|
||||
this.setData({
|
||||
isAttendant,
|
||||
identityText: detail.role === 'admin' ? '管理员' : (attendant ? attendant.text : '')
|
||||
})
|
||||
if (isAttendant) this.loadServiceArea()
|
||||
})
|
||||
.catch(() => {})
|
||||
},
|
||||
|
||||
/**
|
||||
* 服务城市:以员工档案 attendantInfo.serviceAreas 为准
|
||||
*/
|
||||
loadServiceArea() {
|
||||
API.employee
|
||||
.getMe()
|
||||
.then((res) => {
|
||||
if (res.code !== 0 || !res.data || !res.data.employee) return
|
||||
const areas = res.data.employee.attendantInfo
|
||||
? res.data.employee.attendantInfo.serviceAreas || []
|
||||
: []
|
||||
this.applyServiceArea(areas[0])
|
||||
})
|
||||
.catch(() => {})
|
||||
},
|
||||
|
||||
applyServiceArea(value) {
|
||||
this.setData({
|
||||
serviceAreaIndex: cityIndex(value),
|
||||
serviceAreaText: value ? cityLabel(value) : '未设置'
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 修改服务城市:只影响订单池可见范围
|
||||
*/
|
||||
onServiceAreaChange(e) {
|
||||
const index = Number(e.detail.value) || 0
|
||||
const option = CITY_OPTIONS[index]
|
||||
if (!option) return
|
||||
|
||||
wx.showLoading({ title: '保存中...' })
|
||||
API.employee
|
||||
.setServiceArea(option.value)
|
||||
.then((res) => {
|
||||
wx.hideLoading()
|
||||
if (res.code === 0) {
|
||||
this.applyServiceArea(option.value)
|
||||
wx.showToast({ title: '服务城市已更新', icon: 'success' })
|
||||
return
|
||||
}
|
||||
wx.showToast({ title: res.msg || '保存失败', icon: 'none' })
|
||||
})
|
||||
.catch((err) => {
|
||||
wx.hideLoading()
|
||||
wx.showToast({ title: (err && err.message) || '网络错误,请重试', icon: 'none' })
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 证件材料后补入口
|
||||
*/
|
||||
onMaterialsTap() {
|
||||
wx.navigateTo({ url: '/pages/materials/index' })
|
||||
},
|
||||
|
||||
/**
|
||||
* 加载当前登录用户信息
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user