小程序页面视觉对齐二期:预约图片轮播、订单数据预览、微信用户关联与请假管理
新增预约详情作品图片轮播字段与组装;新增订单预览与未关联微信用户候选接口;补齐请假记录查询接口;订单数据预览改为四列;请假管理接入真实排班例外并支持新增;日程、我的、美甲师详情与改派选择器按设计稿微调;注册结果页与申请提交时间对齐设计稿。
This commit is contained in:
@@ -30,6 +30,13 @@ module.exports = {
|
||||
})
|
||||
},
|
||||
|
||||
unlinkedCandidates(params) {
|
||||
return request({
|
||||
url: '/manager/employees/users/unlinked-candidates',
|
||||
params
|
||||
})
|
||||
},
|
||||
|
||||
schedules(params) {
|
||||
return request({
|
||||
url: '/manager/employees/schedules',
|
||||
@@ -68,6 +75,13 @@ module.exports = {
|
||||
})
|
||||
},
|
||||
|
||||
scheduleExceptions(params) {
|
||||
return request({
|
||||
url: '/manager/employees/schedule-exceptions',
|
||||
params
|
||||
})
|
||||
},
|
||||
|
||||
reviewSummary() {
|
||||
return request({
|
||||
url: '/user/workbench/registration/summary'
|
||||
|
||||
@@ -14,6 +14,13 @@ module.exports = {
|
||||
})
|
||||
},
|
||||
|
||||
orderPreview(params) {
|
||||
return request({
|
||||
url: '/manager/orders/preview',
|
||||
params
|
||||
})
|
||||
},
|
||||
|
||||
createAppointment(data) {
|
||||
return request({
|
||||
url: '/manager/planning/appointments',
|
||||
|
||||
@@ -185,7 +185,7 @@ button::after {
|
||||
.field {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
min-height: 108rpx;
|
||||
min-height: 112rpx;
|
||||
border-bottom: 1rpx solid var(--theme-border);
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
min-height: 92rpx;
|
||||
min-height: 96rpx;
|
||||
padding: 0 28rpx;
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@
|
||||
.selector-search-wrap {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
min-height: 80rpx;
|
||||
min-height: 83rpx;
|
||||
margin: 0 28rpx 18rpx;
|
||||
padding: 0 22rpx;
|
||||
border: 1rpx solid #e7ece9;
|
||||
@@ -155,7 +155,7 @@
|
||||
.selector-sort { flex: 0 0 auto; color: #476259; }
|
||||
|
||||
.selector-search {
|
||||
height: 78rpx;
|
||||
height: 81rpx;
|
||||
flex: 1;
|
||||
color: #17211f;
|
||||
font-size: 27rpx;
|
||||
@@ -174,9 +174,9 @@
|
||||
.selector-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
min-height: 112rpx;
|
||||
min-height: 156rpx;
|
||||
margin-bottom: 14rpx;
|
||||
padding: 20rpx;
|
||||
padding: 26rpx;
|
||||
border: 1rpx solid #e7ece9;
|
||||
border-radius: 24rpx;
|
||||
background: #fff;
|
||||
@@ -209,8 +209,8 @@
|
||||
.selector-item.card-view .selector-check { position: absolute; right: 18rpx; bottom: 16rpx; }
|
||||
|
||||
.selector-avatar {
|
||||
width: 76rpx;
|
||||
height: 76rpx;
|
||||
width: 80rpx;
|
||||
height: 80rpx;
|
||||
flex: 0 0 auto;
|
||||
border-radius: 50%;
|
||||
background: #e7ece9;
|
||||
|
||||
@@ -18,6 +18,8 @@ Page({
|
||||
data: {
|
||||
id: '',
|
||||
appointment: {},
|
||||
coverImages: [],
|
||||
coverIndex: 0,
|
||||
avatarText: '',
|
||||
timeText: '',
|
||||
isUnassigned: false,
|
||||
@@ -74,8 +76,13 @@ Page({
|
||||
remarkText: displayValue(safeAppointment.remark, '暂无备注'),
|
||||
cancelReasonText: displayValue(safeAppointment.cancelReason, '')
|
||||
}
|
||||
const coverImages = Array.isArray(safeAppointment.coverImages)
|
||||
? safeAppointment.coverImages.filter(item => Boolean(item))
|
||||
: []
|
||||
this.setData({
|
||||
appointment: normalizedAppointment,
|
||||
coverImages,
|
||||
coverIndex: 0,
|
||||
isUnassigned,
|
||||
avatarText: normalizedAppointment.customerNameText.slice(0, 1),
|
||||
timeText,
|
||||
@@ -87,6 +94,10 @@ Page({
|
||||
})
|
||||
},
|
||||
|
||||
onCoverChange(event) {
|
||||
this.setData({ coverIndex: Number(event.detail.current) || 0 })
|
||||
},
|
||||
|
||||
async updateStatus(status) {
|
||||
if (this.data.updating || !this.data.appointment.orderId) return
|
||||
if (status !== 3 && this.data.isUnassigned) {
|
||||
|
||||
@@ -56,6 +56,24 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view wx:if="{{!loadError && coverImages.length}}" class="section cover-section">
|
||||
<view class="cover-head">
|
||||
<text class="section-title">项目图片</text>
|
||||
<text class="cover-count">{{coverIndex + 1}} / {{coverImages.length}}</text>
|
||||
</view>
|
||||
<view class="cover-card">
|
||||
<swiper class="cover-swiper" circular="{{coverImages.length > 1}}" bindchange="onCoverChange">
|
||||
<swiper-item wx:for="{{coverImages}}" wx:key="*this">
|
||||
<image class="cover-image" src="{{item}}" mode="aspectFill" />
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
<view class="cover-dots">
|
||||
<view wx:for="{{coverImages}}" wx:key="*this" class="cover-dot {{index === coverIndex ? 'active' : ''}}"></view>
|
||||
</view>
|
||||
</view>
|
||||
<text class="cover-hint">左滑查看更多项目图</text>
|
||||
</view>
|
||||
|
||||
<view wx:if="{{!loadError}}" class="section">
|
||||
<view class="section-title">备注</view>
|
||||
<view class="card note-card">{{appointment.remarkText}}</view>
|
||||
|
||||
@@ -164,6 +164,75 @@
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.cover-section {
|
||||
margin-top: 28rpx;
|
||||
}
|
||||
|
||||
.cover-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
|
||||
.cover-count {
|
||||
color: #71807a;
|
||||
font-size: 22rpx;
|
||||
}
|
||||
|
||||
.cover-card {
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
height: 304rpx;
|
||||
padding: 20rpx;
|
||||
border-radius: 24rpx;
|
||||
background: #fbfdfb;
|
||||
border: 1rpx solid #e7ece9;
|
||||
}
|
||||
|
||||
.cover-swiper {
|
||||
width: 100%;
|
||||
height: 208rpx;
|
||||
border-radius: 16rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.cover-image {
|
||||
width: 100%;
|
||||
height: 208rpx;
|
||||
border-radius: 16rpx;
|
||||
background: #e5f4ed;
|
||||
}
|
||||
|
||||
.cover-dots {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 10rpx;
|
||||
height: 56rpx;
|
||||
}
|
||||
|
||||
.cover-dot {
|
||||
width: 10rpx;
|
||||
height: 10rpx;
|
||||
border-radius: 50%;
|
||||
background: #d5ddd9;
|
||||
transition: width 0.2s;
|
||||
}
|
||||
|
||||
.cover-dot.active {
|
||||
width: 26rpx;
|
||||
border-radius: 6rpx;
|
||||
background: #247b63;
|
||||
}
|
||||
|
||||
.cover-hint {
|
||||
display: block;
|
||||
margin-top: 12rpx;
|
||||
color: #a1aca6;
|
||||
font-size: 20rpx;
|
||||
}
|
||||
|
||||
.note-card {
|
||||
padding: 24rpx;
|
||||
color: #71807a;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -3,6 +3,12 @@ const { toUserMessage } = require('../../utils/toast')
|
||||
|
||||
const EMPLOYEE_COLORS = ['#7AA9C2', '#8EB99B', '#BDA7D8', '#D7B17D', '#D98D8D']
|
||||
|
||||
function formatAmount(value) {
|
||||
const amount = Number(value || 0)
|
||||
if (!Number.isFinite(amount)) return '0'
|
||||
return amount.toLocaleString('zh-CN', { maximumFractionDigits: 2 })
|
||||
}
|
||||
|
||||
Page({
|
||||
data: {
|
||||
id: '',
|
||||
@@ -30,7 +36,9 @@ Page({
|
||||
color: data.color || EMPLOYEE_COLORS[0],
|
||||
monthOrders,
|
||||
monthAmount,
|
||||
avgAmount: monthOrders > 0 ? Math.round(monthAmount / monthOrders) : 0
|
||||
monthAmountText: formatAmount(monthAmount),
|
||||
avgAmount: monthOrders > 0 ? Math.round(monthAmount / monthOrders) : 0,
|
||||
avgAmountText: formatAmount(monthOrders > 0 ? Math.round(monthAmount / monthOrders) : 0)
|
||||
}
|
||||
})
|
||||
} catch (error) {
|
||||
|
||||
@@ -19,11 +19,11 @@
|
||||
<text class="stat-label">本月订单</text>
|
||||
</view>
|
||||
<view class="card stat">
|
||||
<text class="stat-value">¥{{employee.monthAmount}}</text>
|
||||
<text class="stat-value">¥{{employee.monthAmountText}}</text>
|
||||
<text class="stat-label">本月营业额</text>
|
||||
</view>
|
||||
<view class="card stat">
|
||||
<text class="stat-value">¥{{employee.avgAmount}}</text>
|
||||
<text class="stat-value">¥{{employee.avgAmountText}}</text>
|
||||
<text class="stat-label">平均客单价</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -11,13 +11,6 @@ function shortDateTime(value) {
|
||||
return text.length > 16 ? text.slice(0, 16) : text || '-'
|
||||
}
|
||||
|
||||
function timeRange(item) {
|
||||
const start = String(item.startTime || '').slice(11, 16)
|
||||
const end = String(item.endTime || '').slice(11, 16)
|
||||
if (!start && !end) return '-'
|
||||
return `${start || '-'}-${end || '-'}`
|
||||
}
|
||||
|
||||
function scheduleSummary(item) {
|
||||
const mode = item.scheduleModeSummary || item.scheduleMode || ''
|
||||
const time = item.scheduleTimeSummary || item.ruleTimeSummary || ''
|
||||
@@ -73,21 +66,20 @@ Page({
|
||||
},
|
||||
|
||||
async loadOrderPreview() {
|
||||
const data = await planningApi.calendar({
|
||||
const data = await planningApi.orderPreview({
|
||||
startDate: this.data.startDate,
|
||||
endDate: this.data.endDate
|
||||
})
|
||||
const rows = (data.appointments || []).slice(0, PREVIEW_SIZE).map((item, index) => ({
|
||||
key: `order-${item.orderItemId || index}`,
|
||||
date: item.date || String(item.startTime || '').slice(0, 10) || '-',
|
||||
customer: item.customerName || '到店客户',
|
||||
product: item.productTitle || '预约作品',
|
||||
artist: item.artistName || '未分配',
|
||||
time: timeRange(item),
|
||||
status: item.statusText || '-'
|
||||
const list = Array.isArray(data) ? data : (data.list || [])
|
||||
const rows = list.slice(0, PREVIEW_SIZE).map((item, index) => ({
|
||||
key: `order-${item.orderNo || item.id || index}`,
|
||||
orderNo: item.orderNo || '-',
|
||||
amount: item.actualAmount === null || item.actualAmount === undefined ? '-' : `¥${item.actualAmount}`,
|
||||
status: item.statusText || '-',
|
||||
createTime: shortDateTime(item.createTime && String(item.createTime).replace('T', ' '))
|
||||
}))
|
||||
this.setData({
|
||||
previewColumns: ['日期', '客户', '项目', '美甲师', '时间', '状态'],
|
||||
previewColumns: ['订单编号', '实付金额', '状态', '创建时间'],
|
||||
previewRows: rows
|
||||
})
|
||||
},
|
||||
|
||||
@@ -19,12 +19,10 @@
|
||||
</view>
|
||||
<view wx:for="{{previewRows}}" wx:key="key" class="preview-row">
|
||||
<block wx:if="{{type === '订单数据'}}">
|
||||
<text class="preview-cell">{{item.date}}</text>
|
||||
<text class="preview-cell">{{item.customer}}</text>
|
||||
<text class="preview-cell">{{item.product}}</text>
|
||||
<text class="preview-cell">{{item.artist}}</text>
|
||||
<text class="preview-cell">{{item.time}}</text>
|
||||
<text class="preview-cell order-no">{{item.orderNo}}</text>
|
||||
<text class="preview-cell">{{item.amount}}</text>
|
||||
<text class="preview-cell">{{item.status}}</text>
|
||||
<text class="preview-cell">{{item.createTime}}</text>
|
||||
</block>
|
||||
<block wx:elif="{{type === '客户数据'}}">
|
||||
<text class="preview-cell">{{item.name}}</text>
|
||||
|
||||
@@ -38,12 +38,13 @@
|
||||
}
|
||||
|
||||
.preview-table {
|
||||
min-width: 920rpx;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.preview-row {
|
||||
display: flex;
|
||||
min-height: 58rpx;
|
||||
align-items: center;
|
||||
min-height: 68rpx;
|
||||
border-bottom: 1rpx solid #e7ece9;
|
||||
}
|
||||
|
||||
@@ -52,25 +53,32 @@
|
||||
}
|
||||
|
||||
.preview-row-head {
|
||||
border-radius: 8rpx;
|
||||
background: #f3f7f4;
|
||||
min-height: 64rpx;
|
||||
border-bottom: 0;
|
||||
border-radius: 12rpx;
|
||||
background: #f5f7f4;
|
||||
}
|
||||
|
||||
.preview-cell {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
width: 150rpx;
|
||||
min-width: 150rpx;
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
padding: 0 12rpx;
|
||||
overflow: hidden;
|
||||
color: #5e564d;
|
||||
color: #17211f;
|
||||
font-size: 22rpx;
|
||||
line-height: 1.35;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.preview-cell.order-no {
|
||||
flex: 1.35;
|
||||
font-family: "SF Mono", Menlo, monospace;
|
||||
}
|
||||
|
||||
.preview-row-head .preview-cell {
|
||||
color: #17211f;
|
||||
font-weight: 800;
|
||||
color: #71807a;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
@@ -1,11 +1,186 @@
|
||||
const employeesApi = require('../../api/employees')
|
||||
const dateUtil = require('../../utils/date')
|
||||
const { showErrorToast, toUserMessage } = require('../../utils/toast')
|
||||
|
||||
function displayDate(value) {
|
||||
const text = String(value || '').slice(0, 10)
|
||||
return text || '-'
|
||||
}
|
||||
|
||||
function exceptionText(item) {
|
||||
const type = String(item.exceptionType || '').toUpperCase()
|
||||
if (type.includes('FULL')) return '全天请假'
|
||||
const start = String(item.startTime || '').slice(0, 5)
|
||||
const end = String(item.endTime || '').slice(0, 5)
|
||||
if (start || end) return `${start || '-'}-${end || '-'} 请假`
|
||||
return '请假'
|
||||
}
|
||||
|
||||
Page({
|
||||
data: {
|
||||
days: Array.from({ length: 31 }).map((_, index) => ({ day: index + 1, rest: [12, 25].includes(index + 1) })),
|
||||
records: [
|
||||
{ date: '2026-06-12', text: '全天请假' },
|
||||
{ date: '2026-06-25', text: '下午请假' }
|
||||
]
|
||||
days: [],
|
||||
records: [],
|
||||
artists: [],
|
||||
artistNames: {},
|
||||
loading: false,
|
||||
loadError: '',
|
||||
formVisible: false,
|
||||
saving: false,
|
||||
form: {
|
||||
artistIndex: 0,
|
||||
workDate: dateUtil.formatDate(new Date()),
|
||||
exceptionType: 'FULL_DAY',
|
||||
startTime: '09:00',
|
||||
endTime: '18:00',
|
||||
remark: ''
|
||||
}
|
||||
},
|
||||
add() { wx.showToast({ title: '请选择日期后保存', icon: 'none' }) },
|
||||
|
||||
onLoad() {
|
||||
this.month = new Date()
|
||||
this.loadRecords()
|
||||
this.loadArtists()
|
||||
},
|
||||
|
||||
async loadArtists() {
|
||||
try {
|
||||
const data = await employeesApi.list()
|
||||
const list = data.list || data || []
|
||||
const artists = list.map(item => ({
|
||||
id: item.userId || item.id,
|
||||
name: item.nickname || item.name || item.artistName || '美甲师'
|
||||
})).filter(item => item.id)
|
||||
const artistNames = artists.reduce((map, item) => {
|
||||
map[item.id] = item.name
|
||||
return map
|
||||
}, {})
|
||||
this.setData({ artists, artistNames })
|
||||
} catch (error) {
|
||||
// 美甲师列表失败不阻塞请假记录展示。
|
||||
}
|
||||
},
|
||||
|
||||
async loadRecords() {
|
||||
const month = this.month
|
||||
const startDate = `${month.getFullYear()}-${String(month.getMonth() + 1).padStart(2, '0')}-01`
|
||||
const daysInMonth = new Date(month.getFullYear(), month.getMonth() + 1, 0).getDate()
|
||||
const endDate = `${month.getFullYear()}-${String(month.getMonth() + 1).padStart(2, '0')}-${String(daysInMonth).padStart(2, '0')}`
|
||||
this.setData({ loading: true, loadError: '' })
|
||||
try {
|
||||
const list = await employeesApi.scheduleExceptions({ startDate, endDate })
|
||||
const exceptions = Array.isArray(list) ? list : (list && list.list) || []
|
||||
const restDates = new Set(exceptions.map(item => String(item.workDate || '').slice(0, 10)))
|
||||
const days = Array.from({ length: daysInMonth }).map((_, index) => {
|
||||
const date = `${month.getFullYear()}-${String(month.getMonth() + 1).padStart(2, '0')}-${String(index + 1).padStart(2, '0')}`
|
||||
return { date, day: index + 1, rest: restDates.has(date) }
|
||||
})
|
||||
const artistNames = this.data.artistNames || {}
|
||||
const records = exceptions
|
||||
.slice()
|
||||
.sort((left, right) => String(left.workDate).localeCompare(String(right.workDate)))
|
||||
.map(item => ({
|
||||
key: item.id || `${item.workDate}-${item.artistId}`,
|
||||
date: displayDate(item.workDate),
|
||||
text: [exceptionText(item), artistNames[item.artistId]].filter(Boolean).join(' · ')
|
||||
}))
|
||||
this.setData({ days, records })
|
||||
} catch (error) {
|
||||
this.setData({ records: [], loadError: toUserMessage(error, '请假记录加载失败') })
|
||||
} finally {
|
||||
this.setData({ loading: false })
|
||||
}
|
||||
},
|
||||
|
||||
add() {
|
||||
const artists = this.data.artists || []
|
||||
if (!artists.length) {
|
||||
wx.showToast({ title: '暂无可请假的美甲师', icon: 'none' })
|
||||
return
|
||||
}
|
||||
const app = getApp()
|
||||
const userInfo = app.globalData.userInfo || {}
|
||||
const ownIndex = artists.findIndex(item => String(item.id) === String(userInfo.id))
|
||||
this.setData({
|
||||
formVisible: true,
|
||||
form: {
|
||||
artistIndex: ownIndex >= 0 ? ownIndex : 0,
|
||||
workDate: dateUtil.formatDate(new Date()),
|
||||
exceptionType: 'FULL_DAY',
|
||||
startTime: '09:00',
|
||||
endTime: '18:00',
|
||||
remark: ''
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
closeForm() {
|
||||
if (this.data.saving) return
|
||||
this.setData({ formVisible: false })
|
||||
},
|
||||
|
||||
stopTouchMove() {},
|
||||
|
||||
noop() {},
|
||||
|
||||
onArtistChange(event) {
|
||||
this.setData({ 'form.artistIndex': Number(event.detail.value) })
|
||||
},
|
||||
|
||||
onDateChange(event) {
|
||||
this.setData({ 'form.workDate': event.detail.value })
|
||||
},
|
||||
|
||||
selectType(event) {
|
||||
this.setData({ 'form.exceptionType': event.currentTarget.dataset.type })
|
||||
},
|
||||
|
||||
onStartTimeChange(event) {
|
||||
this.setData({ 'form.startTime': event.detail.value })
|
||||
},
|
||||
|
||||
onEndTimeChange(event) {
|
||||
this.setData({ 'form.endTime': event.detail.value })
|
||||
},
|
||||
|
||||
onRemarkInput(event) {
|
||||
this.setData({ 'form.remark': event.detail.value })
|
||||
},
|
||||
|
||||
async save() {
|
||||
if (this.data.saving) return
|
||||
const form = this.data.form
|
||||
const artist = this.data.artists[form.artistIndex]
|
||||
if (!artist) {
|
||||
wx.showToast({ title: '请选择美甲师', icon: 'none' })
|
||||
return
|
||||
}
|
||||
if (!form.workDate) {
|
||||
wx.showToast({ title: '请选择日期后保存', icon: 'none' })
|
||||
return
|
||||
}
|
||||
if (form.exceptionType !== 'FULL_DAY' && dateUtil.minutesOfDay(form.endTime) <= dateUtil.minutesOfDay(form.startTime)) {
|
||||
wx.showToast({ title: '结束时间需晚于开始时间', icon: 'none' })
|
||||
return
|
||||
}
|
||||
this.setData({ saving: true })
|
||||
try {
|
||||
await employeesApi.saveScheduleException({
|
||||
artistId: artist.id,
|
||||
workDate: form.workDate,
|
||||
exceptionType: form.exceptionType,
|
||||
startTime: form.exceptionType === 'FULL_DAY' ? undefined : form.startTime,
|
||||
endTime: form.exceptionType === 'FULL_DAY' ? undefined : form.endTime,
|
||||
remark: form.remark || undefined
|
||||
})
|
||||
this.setData({ formVisible: false })
|
||||
wx.showToast({ title: '请假已保存' })
|
||||
this.loadRecords()
|
||||
} catch (error) {
|
||||
showErrorToast(error, '请假保存失败')
|
||||
} finally {
|
||||
this.setData({ saving: false })
|
||||
}
|
||||
},
|
||||
|
||||
back() { wx.navigateBack() }
|
||||
})
|
||||
|
||||
@@ -1,12 +1,72 @@
|
||||
<view class="page no-tab">
|
||||
<view class="card mini-calendar">
|
||||
<view wx:for="{{days}}" wx:key="date" class="mini-day {{item.rest ? 'rest' : ''}}">{{item.day}}</view>
|
||||
<view class="card leave-card">
|
||||
<view class="leave-calendar">
|
||||
<view wx:for="{{days}}" wx:key="date" class="leave-day {{item.rest ? 'rest' : ''}}">{{item.day}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="section">
|
||||
<view class="section-title">请假记录</view>
|
||||
<view class="list">
|
||||
<view wx:for="{{records}}" wx:key="date" class="card list-card">{{item.date}} {{item.text}}</view>
|
||||
<view class="section-head">
|
||||
<text class="section-title">请假记录</text>
|
||||
<text wx:if="{{loading}}" class="section-note">加载中</text>
|
||||
</view>
|
||||
<view wx:if="{{loadError}}" class="card record-empty">{{loadError}}</view>
|
||||
<view wx:elif="{{!records.length}}" class="card record-empty">暂无请假记录</view>
|
||||
<view wx:else class="list">
|
||||
<view wx:for="{{records}}" wx:key="key" class="card record-card">
|
||||
<text class="record-date">{{item.date}}</text>
|
||||
<text class="record-text">{{item.text}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="fixed-bottom"><button class="primary-btn leave-add" bindtap="add">新增请假</button></view>
|
||||
|
||||
<view wx:if="{{formVisible}}" class="sheet-mask" catchtouchmove="stopTouchMove" bindtap="closeForm">
|
||||
<view class="sheet" catchtap="noop">
|
||||
<view class="sheet-head">
|
||||
<text class="sheet-title">新增请假</text>
|
||||
<text class="sheet-close" bindtap="closeForm">×</text>
|
||||
</view>
|
||||
<view class="sheet-body">
|
||||
<view class="sheet-field">
|
||||
<text class="sheet-label">美甲师</text>
|
||||
<picker range="{{artists}}" range-key="name" value="{{form.artistIndex}}" bindchange="onArtistChange">
|
||||
<view class="sheet-value">{{artists[form.artistIndex].name || '请选择'}}</view>
|
||||
</picker>
|
||||
</view>
|
||||
<view class="sheet-field">
|
||||
<text class="sheet-label">请假日期</text>
|
||||
<picker mode="date" value="{{form.workDate}}" bindchange="onDateChange">
|
||||
<view class="sheet-value">{{form.workDate}}</view>
|
||||
</picker>
|
||||
</view>
|
||||
<view class="sheet-field">
|
||||
<text class="sheet-label">请假类型</text>
|
||||
<view class="type-switch">
|
||||
<view class="type-option {{form.exceptionType === 'FULL_DAY' ? 'selected' : ''}}" data-type="FULL_DAY" bindtap="selectType">全天</view>
|
||||
<view class="type-option {{form.exceptionType === 'TIME_RANGE' ? 'selected' : ''}}" data-type="TIME_RANGE" bindtap="selectType">时段</view>
|
||||
</view>
|
||||
</view>
|
||||
<view wx:if="{{form.exceptionType !== 'FULL_DAY'}}" class="sheet-field">
|
||||
<text class="sheet-label">请假时段</text>
|
||||
<view class="time-row">
|
||||
<picker mode="time" value="{{form.startTime}}" bindchange="onStartTimeChange">
|
||||
<view class="time-value">{{form.startTime}}</view>
|
||||
</picker>
|
||||
<text class="time-separator">至</text>
|
||||
<picker mode="time" value="{{form.endTime}}" bindchange="onEndTimeChange">
|
||||
<view class="time-value">{{form.endTime}}</view>
|
||||
</picker>
|
||||
</view>
|
||||
</view>
|
||||
<view class="sheet-field">
|
||||
<text class="sheet-label">备注</text>
|
||||
<input class="sheet-input" value="{{form.remark}}" placeholder="选填" bindinput="onRemarkInput" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="sheet-actions">
|
||||
<button class="secondary-btn sheet-btn" bindtap="closeForm">取消</button>
|
||||
<button class="primary-btn sheet-btn" loading="{{saving}}" disabled="{{saving}}" bindtap="save">保存</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="fixed-bottom"><button class="primary-btn" bindtap="add">新增请假</button></view>
|
||||
</view>
|
||||
|
||||
@@ -1,22 +1,192 @@
|
||||
.mini-calendar {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(7, 1fr);
|
||||
gap: 10rpx;
|
||||
padding: 18rpx;
|
||||
.leave-card {
|
||||
padding: 20rpx;
|
||||
}
|
||||
|
||||
.mini-day {
|
||||
.leave-calendar {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(7, 1fr);
|
||||
gap: 8rpx;
|
||||
}
|
||||
|
||||
.leave-day {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 64rpx;
|
||||
height: 66rpx;
|
||||
border-radius: 10rpx;
|
||||
background: #f3f7f4;
|
||||
color: #71807a;
|
||||
font-size: 29rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.mini-day.rest {
|
||||
.leave-day.rest {
|
||||
background: #e7f0f6;
|
||||
color: #6e9fbd;
|
||||
}
|
||||
|
||||
.section-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.section-note {
|
||||
color: #71807a;
|
||||
font-size: 22rpx;
|
||||
}
|
||||
|
||||
.record-empty {
|
||||
padding: 36rpx 24rpx;
|
||||
color: #71807a;
|
||||
font-size: 24rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.record-card {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
min-height: 92rpx;
|
||||
padding: 0 26rpx;
|
||||
}
|
||||
|
||||
.record-date {
|
||||
color: #17211f;
|
||||
font-size: 29rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.record-text {
|
||||
margin-left: 16rpx;
|
||||
color: #71807a;
|
||||
font-size: 26rpx;
|
||||
}
|
||||
|
||||
.leave-add {
|
||||
height: 80rpx;
|
||||
border-radius: 24rpx;
|
||||
font-size: 27rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.sheet-mask {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
z-index: 60;
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
background: rgba(23, 33, 31, 0.42);
|
||||
}
|
||||
|
||||
.sheet {
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
padding: 30rpx 28rpx calc(28rpx + env(safe-area-inset-bottom));
|
||||
border-radius: 28rpx 28rpx 0 0;
|
||||
background: #ffffff;
|
||||
}
|
||||
|
||||
.sheet-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 12rpx;
|
||||
}
|
||||
|
||||
.sheet-title {
|
||||
color: #17211f;
|
||||
font-size: 32rpx;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.sheet-close {
|
||||
padding: 0 10rpx;
|
||||
color: #71807a;
|
||||
font-size: 40rpx;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.sheet-field {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
min-height: 88rpx;
|
||||
border-bottom: 1rpx solid #e7ece9;
|
||||
}
|
||||
|
||||
.sheet-label {
|
||||
flex-shrink: 0;
|
||||
color: #71807a;
|
||||
font-size: 26rpx;
|
||||
}
|
||||
|
||||
.sheet-value {
|
||||
min-width: 240rpx;
|
||||
color: #17211f;
|
||||
font-size: 28rpx;
|
||||
font-weight: 600;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.sheet-input {
|
||||
flex: 1;
|
||||
margin-left: 24rpx;
|
||||
color: #17211f;
|
||||
font-size: 28rpx;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.type-switch {
|
||||
display: flex;
|
||||
gap: 10rpx;
|
||||
}
|
||||
|
||||
.type-option {
|
||||
padding: 10rpx 26rpx;
|
||||
border-radius: 999rpx;
|
||||
background: #f3f7f4;
|
||||
color: #71807a;
|
||||
font-size: 25rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.type-option.selected {
|
||||
background: #e5f4ed;
|
||||
color: #247b63;
|
||||
}
|
||||
|
||||
.time-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 14rpx;
|
||||
}
|
||||
|
||||
.time-value {
|
||||
padding: 10rpx 22rpx;
|
||||
border-radius: 12rpx;
|
||||
background: #f3f7f4;
|
||||
color: #17211f;
|
||||
font-size: 27rpx;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.time-separator {
|
||||
color: #71807a;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.sheet-actions {
|
||||
display: flex;
|
||||
gap: 16rpx;
|
||||
margin-top: 28rpx;
|
||||
}
|
||||
|
||||
.sheet-btn {
|
||||
flex: 1;
|
||||
height: 80rpx;
|
||||
border-radius: 20rpx;
|
||||
font-size: 27rpx;
|
||||
}
|
||||
|
||||
@@ -18,6 +18,8 @@ function resolveCalendarErrorMessage(error) {
|
||||
return toUserMessage(error, '日程数据加载失败')
|
||||
}
|
||||
|
||||
const LANE_TINTS = ['#EAF3FA', '#FBF1EB', '#EEF5EF']
|
||||
|
||||
function toLocalDate(value) {
|
||||
return value instanceof Date ? new Date(value.getTime()) : new Date(String(value).replace(/-/g, '/'))
|
||||
}
|
||||
@@ -657,7 +659,8 @@ Page({
|
||||
top: (cursor - startMinute) * minuteScale + laneHeaderHeight
|
||||
})
|
||||
}
|
||||
const employeeLanes = filteredArtists.map(artist => {
|
||||
const employeeLanes = filteredArtists.map((artist, artistIndex) => {
|
||||
const tint = LANE_TINTS[artistIndex % LANE_TINTS.length]
|
||||
const blocks = dayAppointments
|
||||
.filter(item => String(item.artistId) === String(artist.id))
|
||||
.filter(item => item.startTime)
|
||||
@@ -670,7 +673,8 @@ Page({
|
||||
left: 12,
|
||||
width: 224,
|
||||
compact: Number(item.durationMinutes || 60) <= 15,
|
||||
timeText: resolveAppointmentTimeText(item)
|
||||
timeText: resolveAppointmentTimeText(item),
|
||||
tint
|
||||
}
|
||||
})
|
||||
return { ...artist, artistId: artist.id, blocks, width: 248 }
|
||||
@@ -682,7 +686,7 @@ Page({
|
||||
laneHeaderHeight,
|
||||
248
|
||||
)
|
||||
const unassignedBlocks = unassignedLayout.blocks
|
||||
const unassignedBlocks = unassignedLayout.blocks.map(block => ({ ...block, tint: '#FFF3E7' }))
|
||||
const lanes = this.data.selectedArtistId ? employeeLanes : [{
|
||||
id: '__unassigned__',
|
||||
artistId: '__unassigned__',
|
||||
|
||||
@@ -110,7 +110,7 @@
|
||||
<text wx:if="{{item.isUnassigned}}" class="lane-unassigned-tag">不占档期</text>
|
||||
</view>
|
||||
<view wx:for="{{hours}}" wx:for-item="hour" wx:key="value" class="hour-line" style="top: {{hour.top}}rpx;"></view>
|
||||
<view wx:for="{{item.blocks}}" wx:for-item="block" wx:key="orderItemId" class="appointment-block {{item.isUnassigned ? 'unassigned-block' : ''}} {{block.status === 0 ? 'pending' : ''}} {{block.compact ? 'compact' : ''}}" style="top: {{block.top}}rpx; left: {{block.left}}rpx; width: {{block.width}}rpx; height: {{block.height}}rpx; border-left-color: {{item.color}};" data-id="{{block.orderItemId}}" bindtap="openAppointment">
|
||||
<view wx:for="{{item.blocks}}" wx:for-item="block" wx:key="orderItemId" class="appointment-block {{item.isUnassigned ? 'unassigned-block' : ''}} {{block.status === 0 ? 'pending' : ''}} {{block.compact ? 'compact' : ''}}" style="top: {{block.top}}rpx; left: {{block.left}}rpx; width: {{block.width}}rpx; height: {{block.height}}rpx; background: {{block.tint || '#ffffff'}}; border-left-color: {{item.color}};" data-id="{{block.orderItemId}}" bindtap="openAppointment">
|
||||
<text class="block-title">{{block.customerName}}</text>
|
||||
<text class="block-meta">{{block.timeText}} · {{block.productTitle}}</text>
|
||||
<view class="block-footer">
|
||||
@@ -132,6 +132,10 @@
|
||||
</view>
|
||||
|
||||
<view wx:if="{{viewMode === 'week'}}" class="section">
|
||||
<view class="week-head">
|
||||
<text class="week-head-title">本周概览</text>
|
||||
<text class="week-head-range">{{weekRange}}</text>
|
||||
</view>
|
||||
<view class="week-strip">
|
||||
<view wx:for="{{weekDays}}" wx:key="date" class="week-day-card card {{item.date === currentDateText ? 'active' : ''}}" data-date="{{item.date}}" bindtap="selectWeekDate" aria-label="查看{{item.date}}日程">
|
||||
<view class="week-card-head"><text class="week-name">{{item.weekName}}</text><text class="week-status {{item.statusText === '休' ? 'rest' : ''}}">{{item.statusText}}</text></view>
|
||||
|
||||
@@ -341,13 +341,14 @@
|
||||
}
|
||||
|
||||
.summary-item {
|
||||
min-height: 116rpx;
|
||||
padding: 16rpx;
|
||||
}
|
||||
|
||||
.summary-value {
|
||||
display: block;
|
||||
color: #17211f;
|
||||
font-size: 34rpx;
|
||||
font-size: 36rpx;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
@@ -457,8 +458,8 @@
|
||||
gap: 2rpx;
|
||||
overflow: hidden;
|
||||
padding: 6rpx 10rpx;
|
||||
border-left: 8rpx solid #7ba7c7;
|
||||
border-radius: 10px;
|
||||
border-left: 6rpx solid #7ba7c7;
|
||||
border-radius: 16rpx;
|
||||
background: #fff7ee;
|
||||
border-top: 1rpx solid rgba(58, 48, 34, 0.06);
|
||||
border-right: 1rpx solid rgba(58, 48, 34, 0.06);
|
||||
@@ -554,6 +555,10 @@
|
||||
font-size: 22rpx;
|
||||
}
|
||||
|
||||
.week-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12rpx; }
|
||||
.week-head-title { color: #17211f; font-size: 25rpx; font-weight: 600; }
|
||||
.week-head-range { color: #71807a; font-size: 20rpx; }
|
||||
|
||||
.week-strip {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(7, minmax(0, 1fr));
|
||||
@@ -572,7 +577,8 @@
|
||||
}
|
||||
|
||||
.week-day-card.active {
|
||||
outline: 3rpx solid #8fb89a;
|
||||
background: #e5f4ed;
|
||||
border-color: #cfe4d9;
|
||||
}
|
||||
|
||||
.week-name,
|
||||
@@ -796,7 +802,7 @@
|
||||
}
|
||||
|
||||
.month-cell {
|
||||
min-height: 168rpx;
|
||||
min-height: 136rpx;
|
||||
padding: 8rpx 5rpx;
|
||||
border-right: 1rpx solid #e7ece9;
|
||||
border-bottom: 1rpx solid #e7ece9;
|
||||
|
||||
@@ -21,10 +21,21 @@ function resolveIdentityRole(type) {
|
||||
return ''
|
||||
}
|
||||
|
||||
const MANAGER_MENUS = [
|
||||
{ title: '个人信息', url: '/pages/profile-edit/index' },
|
||||
{ title: '店铺信息', url: '/pages/shop-settings/index' },
|
||||
{ title: '账号安全', url: '/pages/account-settings/index' },
|
||||
{ title: '订单数据', url: '/pages/export/index' },
|
||||
{ title: '关于系统', url: '/pages/about/index' }
|
||||
]
|
||||
|
||||
const ARTIST_MENUS = MANAGER_MENUS.filter(item => item.title !== '店铺信息')
|
||||
|
||||
Page({
|
||||
data: {
|
||||
roleText: '管理端',
|
||||
identityRole: '',
|
||||
activeRole: '',
|
||||
profileCard: buildProfileCard({}, BRAND_CONFIG.defaultShopName),
|
||||
overviewLoading: false,
|
||||
overview: {
|
||||
@@ -37,13 +48,7 @@ Page({
|
||||
shopOpen: true,
|
||||
shopStatus: '营业中'
|
||||
},
|
||||
menus: [
|
||||
{ title: '个人信息', url: '/pages/profile-edit/index' },
|
||||
{ title: '店铺信息', url: '/pages/shop-settings/index' },
|
||||
{ title: '账号安全', url: '/pages/account-settings/index' },
|
||||
{ title: '订单数据', url: '/pages/export/index' },
|
||||
{ title: '关于系统', url: '/pages/about/index' }
|
||||
]
|
||||
menus: MANAGER_MENUS
|
||||
},
|
||||
|
||||
onShow() {
|
||||
@@ -88,13 +93,26 @@ Page({
|
||||
const app = getApp()
|
||||
const userInfo = app.globalData.userInfo || {}
|
||||
const fallbackShopName = app.globalData.shopName || BRAND_CONFIG.defaultShopName
|
||||
const identityRole = resolveIdentityRole(userInfo.type)
|
||||
const activeRole = this.data.activeRole || identityRole
|
||||
this.setData({
|
||||
roleText: resolveRoleText(userInfo.type),
|
||||
identityRole: resolveIdentityRole(userInfo.type),
|
||||
identityRole,
|
||||
activeRole,
|
||||
menus: activeRole === 'artist' ? ARTIST_MENUS : MANAGER_MENUS,
|
||||
profileCard: buildProfileCard(userInfo, fallbackShopName)
|
||||
})
|
||||
},
|
||||
|
||||
switchRole(event) {
|
||||
const role = event.currentTarget.dataset.role
|
||||
if (!role || role === this.data.activeRole) return
|
||||
this.setData({
|
||||
activeRole: role,
|
||||
menus: role === 'artist' ? ARTIST_MENUS : MANAGER_MENUS
|
||||
})
|
||||
},
|
||||
|
||||
go(event) {
|
||||
wx.navigateTo({ url: event.currentTarget.dataset.url })
|
||||
},
|
||||
@@ -150,9 +168,13 @@ Page({
|
||||
shopName: nextUserInfo.shopName || session.shopName,
|
||||
userInfo: nextUserInfo
|
||||
})
|
||||
const identityRole = resolveIdentityRole(nextUserInfo.type)
|
||||
const activeRole = this.data.activeRole || identityRole
|
||||
this.setData({
|
||||
roleText: resolveRoleText(nextUserInfo.type),
|
||||
identityRole: resolveIdentityRole(nextUserInfo.type),
|
||||
identityRole,
|
||||
activeRole,
|
||||
menus: activeRole === 'artist' ? ARTIST_MENUS : MANAGER_MENUS,
|
||||
profileCard: buildProfileCard(nextUserInfo, BRAND_CONFIG.defaultShopName)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
</view>
|
||||
</view>
|
||||
<view wx:if="{{identityRole}}" class="role-switch">
|
||||
<text class="role-chip {{identityRole === 'manager' ? 'is-active' : ''}}">店长</text>
|
||||
<text class="role-chip {{identityRole === 'artist' ? 'is-active' : ''}}">美甲师</text>
|
||||
<text class="role-chip {{activeRole === 'manager' ? 'is-active' : ''}}" data-role="manager" bindtap="switchRole">店长</text>
|
||||
<text class="role-chip {{activeRole === 'artist' ? 'is-active' : ''}}" data-role="artist" bindtap="switchRole">美甲师</text>
|
||||
</view>
|
||||
<text wx:else class="role-badge">{{roleText}}</text>
|
||||
</view>
|
||||
|
||||
@@ -157,11 +157,15 @@ Page({
|
||||
RETRY: '资料内容待重新审核,审核完成前不会展示',
|
||||
MISSING: '资料尚未进入审核,请联系门店负责人确认'
|
||||
}[moderationStatus] || ''
|
||||
const submittedAt = result && result.createTime
|
||||
? this.formatSubmissionTime(new Date(String(result.createTime).replace('T', ' ').replace(/-/g, '/')))
|
||||
: ''
|
||||
return {
|
||||
registrationStatus: result || null,
|
||||
registrationStatusText: statusText,
|
||||
contentStatusText,
|
||||
contentStatusReason: result && result.contentModerationReason || ''
|
||||
contentStatusReason: result && result.contentModerationReason || '',
|
||||
...(submittedAt ? { applicationSubmittedAt: submittedAt } : {})
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -238,7 +238,7 @@
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding-top: 64rpx;
|
||||
padding-top: 48rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
@@ -246,12 +246,12 @@
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 92rpx;
|
||||
height: 92rpx;
|
||||
width: 144rpx;
|
||||
height: 144rpx;
|
||||
border-radius: 50%;
|
||||
background: #e5f4ed;
|
||||
color: #247b63;
|
||||
font-size: 48rpx;
|
||||
font-size: 40rpx;
|
||||
font-weight: 800;
|
||||
}
|
||||
.result-icon.approved { background: #e5f4ed; color: #247b63; }
|
||||
@@ -259,14 +259,14 @@
|
||||
.content-review-status { width: 100%; box-sizing: border-box; margin-top: 16rpx; padding: 16rpx 20rpx; border-radius: 12rpx; background: #f3f7f4; color: #587061; font-size: 22rpx; line-height: 1.5; }
|
||||
.content-review-reason { display: block; margin-top: 6rpx; color: #a24f42; }
|
||||
|
||||
.result-card .section-title { margin-top: 24rpx; }
|
||||
.result-status { margin-top: 28rpx; padding: 18rpx 28rpx; border-radius: 12rpx; background: #e5f4ed; color: #75887b; font-size: 24rpx; }
|
||||
.result-status text { color: #c28b47; font-weight: 700; }
|
||||
.registration-details { width: 100%; box-sizing: border-box; margin-top: 20rpx; padding: 8rpx 18rpx; border-radius: 14rpx; background: #f3f8f3; text-align: left; }
|
||||
.registration-detail { display: flex; align-items: flex-start; justify-content: space-between; gap: 20rpx; padding: 12rpx 0; border-bottom: 1rpx solid #e2ebe3; font-size: 22rpx; line-height: 1.45; }
|
||||
.result-card .section-title { margin-top: 36rpx; }
|
||||
.result-status { width: 100%; box-sizing: border-box; margin-top: 32rpx; color: #17211f; font-size: 25rpx; text-align: left; }
|
||||
.result-status text { color: #d59a52; font-weight: 700; }
|
||||
.registration-details { width: 100%; box-sizing: border-box; margin-top: 12rpx; padding: 0; background: transparent; text-align: left; }
|
||||
.registration-detail { display: flex; align-items: flex-start; justify-content: space-between; gap: 20rpx; padding: 16rpx 0; border-bottom: 1rpx solid #ededed; font-size: 23rpx; line-height: 1.45; }
|
||||
.registration-detail:last-child { border-bottom: 0; }
|
||||
.registration-detail text:first-child { flex: none; color: #8b9a91; }
|
||||
.registration-detail text:last-child { min-width: 0; color: #425b4c; text-align: right; overflow-wrap: anywhere; }
|
||||
.registration-detail text:first-child { flex: none; color: #71807a; }
|
||||
.registration-detail text:last-child { min-width: 0; color: #17211f; text-align: right; overflow-wrap: anywhere; }
|
||||
.safe-note { margin-top: 28rpx; color: #9aa9a0; font-size: 21rpx; line-height: 1.5; text-align: center; }
|
||||
.avatar-pick-field { margin-top: 26rpx; }
|
||||
.avatar-pick {
|
||||
|
||||
Reference in New Issue
Block a user