diff --git a/app.json b/app.json index 5c94a9b..8346985 100644 --- a/app.json +++ b/app.json @@ -4,6 +4,8 @@ "pages/ai/aichat", "pages/escort/itemdetail", "pages/escort/itemlist", + "pages/escort/attendants", + "pages/escort/attendantdetail", "pages/escort/recordlist", "pages/escort/agreement", "pages/escort/recorddetail", diff --git a/pages/escort/attendantdetail.js b/pages/escort/attendantdetail.js new file mode 100644 index 0000000..ccfaddd --- /dev/null +++ b/pages/escort/attendantdetail.js @@ -0,0 +1,92 @@ +const API = require('../../utils/api.js') + +const SELECTED_ATTENDANT_KEY = 'escort_selected_attendant' + +function calcAge(birthday) { + if (!birthday) return '' + const birth = new Date(String(birthday).replace(/-/g, '/')) + if (Number.isNaN(birth.getTime())) return '' + const now = new Date() + let age = now.getFullYear() - birth.getFullYear() + const monthDiff = now.getMonth() - birth.getMonth() + if (monthDiff < 0 || (monthDiff === 0 && now.getDate() < birth.getDate())) age -= 1 + return age > 0 ? `${age} 岁` : '' +} + +Page({ + data: { + attendant: null, + loading: true, + loadError: '', + selectMode: false + }, + + onLoad(options) { + this.id = options.id + const selectMode = String(options.select) === '1' + this.setData({ selectMode }) + if (!this.id) { + this.setData({ loading: false, loadError: '缺少陪诊师ID' }) + return + } + this.loadAttendant() + }, + + async loadAttendant() { + this.setData({ loading: true, loadError: '' }) + try { + const res = await API.escort.getAttendantById(this.id) + if (!res || res.code !== 0) throw new Error((res && res.msg) || '加载失败') + const attendant = this.decorate(res.data && res.data.attendant) + this.setData({ attendant }) + wx.setNavigationBarTitle({ title: attendant.name || '陪诊师详情' }) + } catch (err) { + this.setData({ loadError: err.message || '加载失败,请稍后重试' }) + } finally { + this.setData({ loading: false }) + } + }, + + decorate(attendant) { + if (!attendant) return null + const name = attendant.name || '' + const sexMap = { male: '男', female: '女' } + const meta = [ + sexMap[attendant.sex] || '', + calcAge(attendant.birthday), + attendant.workYears ? `从业 ${attendant.workYears} 年` : '' + ].filter(Boolean) + return { + ...attendant, + initial: name.replace(/[**]/g, '').slice(0, 1) || '陪', + metaText: meta.join(' · '), + areaText: (attendant.serviceAreas || []).join('、'), + languageText: (attendant.languages || []).join('、'), + trainings: attendant.trainings || [], + specialties: attendant.specialties || [] + } + }, + + onRetry() { + if (this.id) this.loadAttendant() + }, + + onSelect() { + const attendant = this.data.attendant + if (!attendant || !attendant.id) return + wx.setStorageSync(SELECTED_ATTENDANT_KEY, { + id: attendant.id, + name: attendant.name, + workYears: attendant.workYears || 0, + orderCount: attendant.orderCount || 0 + }) + + if (this.data.selectMode) { + // 下单页 → 列表 → 详情,选人后直接回到下单页 + const pages = getCurrentPages() + wx.navigateBack({ delta: pages.length >= 3 ? 2 : 1 }) + return + } + wx.redirectTo({ url: '/pages/escort/itemorder' }) + } +}) diff --git a/pages/escort/attendantdetail.json b/pages/escort/attendantdetail.json new file mode 100644 index 0000000..7295a5f --- /dev/null +++ b/pages/escort/attendantdetail.json @@ -0,0 +1,3 @@ +{ + "navigationBarTitleText": "陪诊师详情" +} diff --git a/pages/escort/attendantdetail.wxml b/pages/escort/attendantdetail.wxml new file mode 100644 index 0000000..d1961bb --- /dev/null +++ b/pages/escort/attendantdetail.wxml @@ -0,0 +1,73 @@ + + + 加载中... + + + {{ loadError }},点击重试 + + + + + {{ attendant.initial }} + + + {{ attendant.name }} + 已接 {{ attendant.orderCount }} 单 + + {{ attendant.metaText }} + + {{ tag }} + + + + + + + 服务区域 + {{ attendant.areaText }} + + + 服务语言 + {{ attendant.languageText }} + + + 资质核验 + {{ attendant.qualificationVerified ? '已核验' : '核验中' }} + + + 健康证明 + + {{ attendant.healthCertificate.valid ? '有效' : '待更新' }}{{ attendant.healthCertificate.expireDate ? '(至 ' + attendant.healthCertificate.expireDate + ')' : '' }} + + + + + + 个人介绍 + {{ attendant.introduction }} + + + + 培训与资质 + + {{ item.title }} + {{ item.org }}{{ item.date ? ' · ' + item.date : '' }} + + + + + 服务评价 + + {{ attendant.review.score ? attendant.review.score + ' 分' : '评价较少' }} + 共 {{ attendant.review.count }} 条评价 + + 暂无评价,期待您的服务反馈 + + + + + + + + + diff --git a/pages/escort/attendantdetail.wxss b/pages/escort/attendantdetail.wxss new file mode 100644 index 0000000..5019b34 --- /dev/null +++ b/pages/escort/attendantdetail.wxss @@ -0,0 +1,230 @@ +page { + background: var(--paper); +} + +.page-bg { + min-height: 100vh; + background: var(--paper); +} + +.container { + padding: 32rpx 32rpx calc(40rpx + env(safe-area-inset-bottom)); +} + +.state-card { + margin-top: 40rpx; + padding: 80rpx 32rpx; + border: 2rpx solid var(--line); + border-radius: 24rpx; + background: var(--white); + box-shadow: var(--shadow-card); + color: var(--muted); + font-size: var(--fs-28); + text-align: center; +} + +.profile-card { + display: flex; + align-items: flex-start; + padding: 32rpx 28rpx; + border: 2rpx solid var(--brand-line); + border-radius: 28rpx; + background: var(--brand-soft); +} + +.avatar { + display: flex; + flex-shrink: 0; + align-items: center; + justify-content: center; + width: 112rpx; + height: 112rpx; + border-radius: 50%; + background: var(--white); + border: 3rpx solid var(--brand-line); + color: var(--brand-ink); + font-size: 46rpx; + font-weight: 700; +} + +.profile-info { + flex: 1; + min-width: 0; + margin-left: 24rpx; +} + +.name-row { + display: flex; + align-items: center; + justify-content: space-between; + gap: 16rpx; +} + +.attendant-name { + min-width: 0; + overflow: hidden; + color: var(--ink); + font-size: 42rpx; + font-weight: 700; + text-overflow: ellipsis; + white-space: nowrap; +} + +.order-count { + flex-shrink: 0; + color: var(--brand-ink); + font-size: var(--fs-24); + font-weight: 600; +} + +.profile-meta { + display: block; + margin-top: 10rpx; + color: var(--ink-2); + font-size: var(--fs-26); + line-height: 1.5; +} + +.tag-row { + display: flex; + flex-wrap: wrap; + gap: 10rpx; + margin-top: 14rpx; +} + +.tag { + padding: 4rpx 14rpx; + border-radius: 8rpx; + background: var(--white); + color: var(--brand-ink); + font-size: var(--fs-24); + line-height: 1.5; +} + +.info-card, +.section-card { + margin-top: 20rpx; + padding: 24rpx 28rpx; + border: 2rpx solid var(--line); + border-radius: 24rpx; + background: var(--white); + box-shadow: var(--shadow-card); +} + +.info-row { + display: flex; + align-items: flex-start; + justify-content: space-between; + gap: 24rpx; + padding: 12rpx 0; +} + +.info-row + .info-row { + border-top: 2rpx dashed var(--line-soft, #E9DECB); +} + +.info-label { + flex-shrink: 0; + color: var(--muted); + font-size: var(--fs-26); +} + +.info-value { + color: var(--ink); + font-size: var(--fs-26); + line-height: 1.5; + text-align: right; +} + +.info-value.ok { + color: var(--brand-ink); + font-weight: 600; +} + +.section-title { + display: block; + color: var(--ink); + font-size: var(--fs-30); + font-weight: 700; +} + +.section-text { + display: block; + margin-top: 14rpx; + color: var(--ink-2); + font-size: var(--fs-28); + line-height: 1.75; +} + +.section-text.muted { + color: var(--muted); +} + +.training-item { + margin-top: 18rpx; + padding-top: 18rpx; + border-top: 2rpx dashed var(--line-soft, #E9DECB); +} + +.training-title { + display: block; + color: var(--ink); + font-size: var(--fs-28); + font-weight: 600; +} + +.training-meta { + display: block; + margin-top: 6rpx; + color: var(--muted); + font-size: var(--fs-24); +} + +.review-row { + display: flex; + align-items: baseline; + gap: 16rpx; + margin-top: 14rpx; +} + +.review-score { + color: var(--brand-ink); + font-size: 40rpx; + font-weight: 700; +} + +.review-count { + color: var(--muted); + font-size: var(--fs-24); +} + +.bottom-space { + height: 140rpx; +} + +.bottom-bar { + position: fixed; + right: 0; + bottom: 0; + left: 0; + padding: 18rpx 32rpx calc(18rpx + env(safe-area-inset-bottom)); + background: rgba(255, 252, 246, 0.96); + border-top: 2rpx solid var(--line); + backdrop-filter: blur(12rpx); +} + +.cta-btn { + width: 100%; + height: 92rpx; + border: none; + border-radius: 999rpx; + background: var(--brand-strong); + color: var(--white); + font-size: var(--fs-30); + font-weight: 700; + line-height: 92rpx; +} + +.cta-btn::after { + border: none; +} diff --git a/pages/escort/attendants.js b/pages/escort/attendants.js new file mode 100644 index 0000000..b6fd72e --- /dev/null +++ b/pages/escort/attendants.js @@ -0,0 +1,98 @@ +const API = require('../../utils/api.js') + +const PAGE_SIZE = 20 +// 下单页与陪诊师列表共用的选择结果 key +const SELECTED_ATTENDANT_KEY = 'escort_selected_attendant' + +Page({ + data: { + attendants: [], + loading: false, + loadError: '', + hasMore: true, + selectMode: false + }, + + onLoad(options) { + const selectMode = String(options.select) === '1' + this.page = 1 + this.setData({ selectMode }) + wx.setNavigationBarTitle({ title: selectMode ? '选择陪诊师' : '陪诊师团队' }) + this.loadAttendants(true) + }, + + async onPullDownRefresh() { + await this.loadAttendants(true) + wx.stopPullDownRefresh() + }, + + onReachBottom() { + if (this.data.hasMore && !this.data.loading) this.loadAttendants(false) + }, + + onRetry() { + this.loadAttendants(true) + }, + + async loadAttendants(reset) { + if (this.data.loading) return + if (reset) { + this.page = 1 + this.setData({ attendants: [], hasMore: true, loadError: '' }) + } + this.setData({ loading: true }) + try { + const res = await API.escort.getAttendants({ page: this.page, pageSize: PAGE_SIZE }) + if (!res || res.code !== 0) throw new Error((res && res.msg) || '加载失败') + const list = (res.data && res.data.attendants ? res.data.attendants : []).map(this.decorate) + this.setData({ + attendants: reset ? list : this.data.attendants.concat(list), + hasMore: list.length >= PAGE_SIZE, + loadError: '' + }) + this.page += 1 + } catch (err) { + this.setData({ loadError: err.message || '加载失败,请稍后重试' }) + } finally { + this.setData({ loading: false }) + } + }, + + // 公示接口已脱敏,这里只补展示用字段,不再加工姓名 + decorate(item) { + const name = item.name || '' + const specialties = item.specialties || [] + const serviceAreas = item.serviceAreas || [] + return { + ...item, + initial: name.replace(/[**]/g, '').slice(0, 1) || '陪', + specialties: specialties.slice(0, 3), + areaText: serviceAreas.join('、') + } + }, + + goToDetail(e) { + const id = e.currentTarget.dataset.id + if (!id) return + const select = this.data.selectMode ? '&select=1' : '' + wx.navigateTo({ url: `/pages/escort/attendantdetail?id=${id}${select}` }) + }, + + onSelect(e) { + const item = e.currentTarget.dataset.item + if (!item || !item.id) return + wx.setStorageSync(SELECTED_ATTENDANT_KEY, { + id: item.id, + name: item.name, + workYears: item.workYears || 0, + orderCount: item.orderCount || 0 + }) + wx.navigateBack() + }, + + // 选择模式下允许明确不指定,由平台抢单 / 指派 + onSkip() { + wx.setStorageSync(SELECTED_ATTENDANT_KEY, { cleared: true }) + wx.navigateBack() + } +}) diff --git a/pages/escort/attendants.json b/pages/escort/attendants.json new file mode 100644 index 0000000..b8735b9 --- /dev/null +++ b/pages/escort/attendants.json @@ -0,0 +1,4 @@ +{ + "navigationBarTitleText": "陪诊师团队", + "enablePullDownRefresh": true +} diff --git a/pages/escort/attendants.wxml b/pages/escort/attendants.wxml new file mode 100644 index 0000000..48da699 --- /dev/null +++ b/pages/escort/attendants.wxml @@ -0,0 +1,62 @@ + + + + + {{ selectMode ? '选择陪诊师' : '陪诊师团队' }} + {{ selectMode ? '可按擅长与服务区域挑选;不选则由平台安排' : '仅展示在岗且已转正的陪诊师' }} + + + 加载中... + + + {{ loadError }},点击重试 + + + 暂无在岗陪诊师,平台会尽快为您安排 + + + + + {{ item.initial }} + + + {{ item.name }} + 已接 {{ item.orderCount }} 单 + + 从业 {{ item.workYears }} 年{{ item.areaText ? ' · ' + item.areaText : '' }} + + {{ tag }} + + + + + + + {{ item.qualificationVerified ? '资质已核验' : '资质待核验' }} + {{ item.healthCertificate.valid ? '健康证有效' : '健康证待更新' }} + + 选择 TA + 查看详情 › + + + + 加载更多... + 已经到底了 + + + + 不指定,平台安排 + + + diff --git a/pages/escort/attendants.wxss b/pages/escort/attendants.wxss new file mode 100644 index 0000000..0a21a07 --- /dev/null +++ b/pages/escort/attendants.wxss @@ -0,0 +1,203 @@ +page { + background: var(--paper); +} + +.page-bg { + min-height: 100vh; + background: var(--paper); +} + +.container { + padding: 0 32rpx calc(48rpx + env(safe-area-inset-bottom)); +} + +.page-header { + padding: 32rpx 0 8rpx; +} + +.header-accent { + width: 64rpx; + height: 8rpx; + border-radius: 4rpx; + background: var(--brand-strong); +} + +.header-title { + display: block; + margin-top: 22rpx; + color: var(--ink); + font-size: 48rpx; + font-weight: 700; + letter-spacing: 1rpx; + line-height: 1.3; +} + +.header-subtitle { + display: block; + margin-top: 12rpx; + color: var(--muted); + font-size: var(--fs-28); + line-height: 1.6; +} + +.state-card { + margin-top: 40rpx; + padding: 80rpx 32rpx; + border: 2rpx solid var(--line); + border-radius: 24rpx; + background: var(--white); + box-shadow: var(--shadow-card); + color: var(--muted); + font-size: var(--fs-28); + text-align: center; +} + +.attendant-list { + margin-top: 28rpx; +} + +.attendant-card { + margin-bottom: 20rpx; + padding: 26rpx 28rpx 22rpx; + border: 2rpx solid var(--line); + border-radius: 24rpx; + background: var(--white); + box-shadow: var(--shadow-card); +} + +.card-main { + display: flex; + align-items: flex-start; +} + +.avatar { + display: flex; + flex-shrink: 0; + align-items: center; + justify-content: center; + width: 92rpx; + height: 92rpx; + border-radius: 50%; + background: var(--brand-soft); + border: 2rpx solid var(--brand-line); + color: var(--brand-ink); + font-size: 38rpx; + font-weight: 700; +} + +.card-info { + flex: 1; + min-width: 0; + margin-left: 22rpx; +} + +.name-row { + display: flex; + align-items: center; + justify-content: space-between; + gap: 16rpx; +} + +.attendant-name { + min-width: 0; + overflow: hidden; + color: var(--ink); + font-size: var(--fs-34); + font-weight: 700; + text-overflow: ellipsis; + white-space: nowrap; +} + +.order-count { + flex-shrink: 0; + color: var(--brand-ink); + font-size: var(--fs-24); + font-weight: 600; +} + +.attendant-meta { + display: block; + margin-top: 8rpx; + color: var(--muted); + font-size: var(--fs-26); + line-height: 1.5; +} + +.tag-row { + display: flex; + flex-wrap: wrap; + gap: 10rpx; + margin-top: 12rpx; +} + +.tag { + padding: 4rpx 14rpx; + border-radius: 8rpx; + background: var(--brand-soft); + color: var(--brand-ink); + font-size: var(--fs-24); + line-height: 1.5; +} + +.card-footer { + display: flex; + align-items: center; + justify-content: space-between; + gap: 16rpx; + margin-top: 20rpx; + padding-top: 18rpx; + border-top: 2rpx dashed var(--line-soft, #E9DECB); +} + +.badges { + display: flex; + flex-wrap: wrap; + gap: 12rpx; + min-width: 0; +} + +.badge { + color: var(--muted); + font-size: var(--fs-24); +} + +.badge.ok { + color: var(--brand-ink); +} + +.select-btn { + flex-shrink: 0; + padding: 12rpx 28rpx; + border: 3rpx solid var(--brand-strong); + border-radius: 999rpx; + background: var(--brand-soft); + color: var(--brand-ink); + font-size: var(--fs-26); + font-weight: 600; +} + +.detail-link { + flex-shrink: 0; + color: var(--brand-ink); + font-size: var(--fs-26); + font-weight: 600; +} + +.list-tip { + padding: 20rpx 0; + color: var(--muted); + font-size: var(--fs-24); + text-align: center; +} + +.skip-entry { + margin-top: 28rpx; + padding: 26rpx 0; + border: 2rpx solid var(--line); + border-radius: 24rpx; + background: var(--white); + color: var(--ink-2); + font-size: var(--fs-28); + font-weight: 600; + text-align: center; +} diff --git a/pages/escort/itemorder.js b/pages/escort/itemorder.js index 3b59246..1c1391e 100644 --- a/pages/escort/itemorder.js +++ b/pages/escort/itemorder.js @@ -6,6 +6,8 @@ const { ensureLogin } = require('../../utils/auth.js') const SERVICE_OPTION_HEIGHT = 108 // 下拉面板最多占用的屏高:扣掉底部固定操作栏与页面留白,项目再多也能整屏看到 const SERVICE_PANEL_RESERVED = 200 +// 与陪诊师列表 / 详情页共用的选择结果 key +const SELECTED_ATTENDANT_KEY = 'escort_selected_attendant' Page({ data: { @@ -44,7 +46,9 @@ Page({ showPayPopup: false, gender: '不限', genderIndex: 0, - genderOptions: ['不限', '男', '女'] + genderOptions: ['不限', '男', '女'], + // 用户指定陪诊师(选填);为空则由平台抢单或管理端指派 + selectedAttendant: null }, onLoad(options) { @@ -54,10 +58,40 @@ Page({ }, onShow() { + // 从陪诊师列表返回时取回用户选择 + this.consumeSelectedAttendant() // 从新增/编辑就诊人页返回时刷新档案,首次进入由 initializePage 加载。 if (this.pageReady && getApp().globalData.user?._id) this.loadProfiles() }, + consumeSelectedAttendant() { + const selected = wx.getStorageSync(SELECTED_ATTENDANT_KEY) + if (!selected) return + wx.removeStorageSync(SELECTED_ATTENDANT_KEY) + if (selected.cleared) { + this.setData({ selectedAttendant: null }) + return + } + if (!selected.id) return + this.setData({ + selectedAttendant: { + id: selected.id, + name: selected.name || '', + workYears: selected.workYears || 0, + orderCount: selected.orderCount || 0 + } + }) + wx.showToast({ title: `已选择 ${selected.name || '陪诊师'}`, icon: 'none' }) + }, + + goToAttendants() { + wx.navigateTo({ url: '/pages/escort/attendants?select=1' }) + }, + + onClearAttendant() { + this.setData({ selectedAttendant: null }) + }, + async initializePage() { this.pageReady = false this.setData({ pageLoading: true, pageError: '' }) @@ -401,7 +435,11 @@ Page({ }, shippingAddress: { address: data.shippingAddress.trim() }, notes: { patientNote: data.remark.trim() }, - payment: { payChannel: data.payChannel } + payment: { payChannel: data.payChannel }, + // 只传 employeeId,姓名 / 电话由服务端按员工档案回填 + ...(data.selectedAttendant + ? { attendant: { employeeId: data.selectedAttendant.id } } + : {}) } }, @@ -473,7 +511,8 @@ Page({ gender: '不限', genderIndex: 0, remark: '', - shippingAddress: '' + shippingAddress: '', + selectedAttendant: null }, () => this.refreshHospitalOptions(provinces[0] || '')) // 重置后仍默认选中第一个就诊人,方便连续预约 const first = this.data.profiles[0] diff --git a/pages/escort/itemorder.wxml b/pages/escort/itemorder.wxml index 8873144..74c846b 100644 --- a/pages/escort/itemorder.wxml +++ b/pages/escort/itemorder.wxml @@ -107,6 +107,21 @@ + + + 指定陪诊师 + + + {{selectedAttendant ? selectedAttendant.name : '平台安排(可选)'}} + + + + + + 从业 {{selectedAttendant.workYears}} 年 · 已接 {{selectedAttendant.orderCount}} 单 + 清除 + + 预约日期 diff --git a/pages/escort/itemorder.wxss b/pages/escort/itemorder.wxss index 7ee3184..5d17602 100644 --- a/pages/escort/itemorder.wxss +++ b/pages/escort/itemorder.wxss @@ -312,6 +312,28 @@ page { transform: rotate(45deg); } +/* 已选陪诊师:展示从业与接单数,支持清除后回到平台安排 */ +.attendant-choice { + display: flex; + align-items: center; + justify-content: space-between; + gap: 16rpx; + margin: -6rpx 0 6rpx; + padding: 10rpx 0 0; +} + +.attendant-choice-text { + color: var(--muted); + font-size: var(--fs-24); +} + +.attendant-choice-clear { + flex-shrink: 0; + color: var(--brand-ink); + font-size: var(--fs-24); + font-weight: 600; +} + .order-textarea { box-sizing: border-box; width: 100%; diff --git a/pages/home/index.js b/pages/home/index.js index 1b0c076..d3c3ccd 100644 --- a/pages/home/index.js +++ b/pages/home/index.js @@ -56,6 +56,13 @@ Page({ // 就诊人是个人健康信息,点击时需登录 needLogin: true }, + { + id: 'attendants', + name: '找陪诊师', + desc: '查看团队', + icon: 'user', + url: '/pages/escort/attendants' + }, { id: 'contact', name: '联系我们',