小程序页面视觉对齐二期:预约图片轮播、订单数据预览、微信用户关联与请假管理

新增预约详情作品图片轮播字段与组装;新增订单预览与未关联微信用户候选接口;补齐请假记录查询接口;订单数据预览改为四列;请假管理接入真实排班例外并支持新增;日程、我的、美甲师详情与改派选择器按设计稿微调;注册结果页与申请提交时间对齐设计稿。
This commit is contained in:
2026-11-06 14:34:02 +08:00
parent 2ff83a5ec1
commit 60d9bba61a
33 changed files with 939 additions and 105 deletions
@@ -12,6 +12,13 @@ Page({
employeeColors: EMPLOYEE_COLORS,
onboardingVisible: false,
createdEmployee: null,
userPickerVisible: false,
userLoading: false,
userKeyword: '',
userCandidates: [],
userItems: [],
selectedWechatUserId: '',
selectedWechatUser: null,
associationSheetVisible: false,
associationLoading: false,
associationApplications: [],
@@ -53,6 +60,68 @@ Page({
this.setData({ 'form.color': event.currentTarget.dataset.color })
},
async openUserPicker() {
if (this.data.creating || this.data.avatarUploading) return
this.setData({ userPickerVisible: true, userLoading: true, userKeyword: '' })
try {
const list = await employeesApi.unlinkedCandidates()
this.applyUserCandidates(Array.isArray(list) ? list : (list && list.list) || [])
} catch (error) {
showErrorToast(error, '微信用户加载失败')
} finally {
this.setData({ userLoading: false })
}
},
applyUserCandidates(candidates) {
this.setData({
userCandidates: candidates,
userItems: candidates.map(item => ({
id: String(item.id),
title: item.nickname || '微信用户',
subtitle: [item.maskedPhone || item.phone, item.createTime && String(item.createTime).replace('T', ' ').slice(0, 10)].filter(Boolean).join(' · ') || '已登录小程序',
meta: item.wechatId || '',
avatar: item.avatar || ''
}))
})
},
onUserSearch(event) {
const userKeyword = String(event.detail.value || '').trim().toLowerCase()
const candidates = this.data.userCandidates
const userItems = candidates
.filter(item => !userKeyword || [item.nickname, item.maskedPhone, item.phone, item.wechatId]
.some(value => String(value || '').toLowerCase().includes(userKeyword)))
.map(item => ({
id: String(item.id),
title: item.nickname || '微信用户',
subtitle: [item.maskedPhone || item.phone, item.createTime && String(item.createTime).replace('T', ' ').slice(0, 10)].filter(Boolean).join(' · ') || '已登录小程序',
meta: item.wechatId || '',
avatar: item.avatar || ''
}))
this.setData({ userKeyword, userItems })
},
selectWechatUser(event) {
const item = event.detail && event.detail.item
if (!item) return
const candidate = this.data.userCandidates.find(user => String(user.id) === String(item.id))
if (!candidate) return
this.setData({
userPickerVisible: false,
selectedWechatUserId: String(candidate.id),
selectedWechatUser: item,
'form.nickname': candidate.nickname || '',
'form.avatar': candidate.avatar || '',
'form.avatarUrl': candidate.avatar || ''
})
},
closeUserPicker() {
if (this.data.userLoading) return
this.setData({ userPickerVisible: false })
},
async chooseAvatar() {
if (this.data.avatarUploading || this.data.creating) return
try {
@@ -95,6 +164,32 @@ Page({
const nickname = String(form.nickname || '').trim()
const phone = String(form.phone || '').trim()
const wechatId = String(form.wechatId || '').trim()
if (this.data.selectedWechatUserId) {
if (!nickname) {
wx.showToast({ title: '请填写美甲师姓名', icon: 'none' })
return
}
this.setData({ creating: true })
try {
const saved = await employeesApi.save({
userId: this.data.selectedWechatUserId,
nickname,
color: form.color,
avatar: form.avatar || undefined
})
const id = saved && typeof saved === 'object' ? (saved.userId || saved.id) : this.data.selectedWechatUserId
this.setData({
createdEmployee: { id, name: nickname, title: nickname, avatar: form.avatar || '' },
applicationApproved: false
})
await this.offerPendingAssociation()
} catch (error) {
showErrorToast(error, '新增失败')
} finally {
this.setData({ creating: false })
}
return
}
if (!nickname || !phone) {
wx.showToast({ title: '请补全美甲师信息', icon: 'none' })
return
@@ -24,10 +24,11 @@
<text class="field-label required">手机号</text>
<input value="{{form.phone}}" data-field="phone" bindinput="onInput" type="number" maxlength="11" placeholder="请输入手机号" />
</view>
<view class="login-unlinked">
<view class="login-unlinked" bindtap="openUserPicker">
<text class="login-unlinked-label">微信登录</text>
<text class="login-unlinked-status">未关联</text>
<text class="login-unlinked-note">可在店长审核微信注册申请时快速关联</text>
<text class="login-unlinked-status">{{selectedWechatUser ? '已选择' : '未关联'}}</text>
<text class="login-unlinked-note">{{selectedWechatUser ? selectedWechatUser.title : '选择已登录小程序的微信用户,可直接关联为美甲师'}}</text>
<text class="login-unlinked-arrow">›</text>
</view>
<view class="field">
<text class="field-label">微信号</text>
@@ -62,5 +63,6 @@
</block>
</view>
</view>
<entity-selector-sheet visible="{{userPickerVisible}}" title="选择微信用户" keyword="{{userKeyword}}" placeholder="搜索昵称或手机号" items="{{userItems}}" selected-id="{{selectedWechatUserId}}" loading="{{userLoading}}" empty-text="暂无未关联的微信用户" action-text="暂不关联" bind:search="onUserSearch" bind:select="selectWechatUser" bind:action="closeUserPicker" bind:close="closeUserPicker" />
<entity-selector-sheet visible="{{associationSheetVisible}}" title="关联待审核申请" keyword="{{associationKeyword}}" placeholder="搜索申请昵称、手机号或编号" items="{{associationItems}}" selected-id="{{associationSelectedId}}" loading="{{associationLoading}}" empty-text="暂无可关联申请" action-text="暂不关联,继续" bind:search="onAssociationSearch" bind:select="selectAssociation" bind:action="skipAssociation" bind:close="skipAssociation" />
</view>
@@ -37,7 +37,8 @@
.login-unlinked-label { color: #536b5d; font-size: 24rpx; font-weight: 700; }
.login-unlinked-status { margin-left: 18rpx; color: #247b63; font-size: 24rpx; font-weight: 700; }
.login-unlinked-note { flex-basis: 100%; margin-top: 10rpx; color: #829287; font-size: 21rpx; }
.login-unlinked-note { flex: 1; flex-basis: 100%; margin-top: 10rpx; color: #829287; font-size: 21rpx; }
.login-unlinked-arrow { flex-shrink: 0; margin-left: 8rpx; color: #247b63; font-size: 30rpx; font-weight: 600; line-height: 1; }
.avatar-card {
display: flex;